diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ca9bd26 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +db.sqlite3 +__pycache__ +TaskBuster.sublime-workspace diff --git a/SlackInvite.sublime-project b/SlackInvite.sublime-project new file mode 100644 index 0000000..2c63c08 --- /dev/null +++ b/SlackInvite.sublime-project @@ -0,0 +1,2 @@ +{ +} diff --git a/SlackInvite.sublime-workspace b/SlackInvite.sublime-workspace new file mode 100644 index 0000000..382ac0f --- /dev/null +++ b/SlackInvite.sublime-workspace @@ -0,0 +1,216 @@ +{ + "auto_complete": + { + "selected_items": + [ + ] + }, + "buffers": + [ + { + "contents": "", + "file": "slack_invite", + "file_size": -1, + "file_write_time": -1, + "settings": + { + "buffer_size": 0, + "line_ending": "Unix" + } + } + ], + "build_system": "", + "build_system_choices": + [ + ], + "build_varint": "", + "command_palette": + { + "height": 267.0, + "last_filter": "Package Control: I", + "selected_items": + [ + [ + "Package Control: I", + "Package Control: Install Package" + ] + ], + "width": 485.0 + }, + "console": + { + "height": 126.0, + "history": + [ + "import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)" + ] + }, + "distraction_free": + { + "menu_visible": true, + "show_minimap": false, + "show_open_files": false, + "show_tabs": false, + "side_bar_visible": false, + "status_bar_visible": false + }, + "file_history": + [ + "/Users/sanchagrins/Code/Python/Django/taskbuster_project/taskbuster/templates/base.html", + "/Users/sanchagrins/Desktop/# Google OAuth", + "/Users/sanchagrins/Code/Python/Django/taskbuster_project/taskbuster/templates/taskbuster/index.html", + "/Users/sanchagrins/Library/Application Support/Sublime Text 3/Packages/Default/Preferences.sublime-settings", + "/Users/sanchagrins/Library/Application Support/Sublime Text 3/Packages/User/Preferences.sublime-settings", + "/Users/sanchagrins/Desktop/bootstrap/example1/index.html", + "/Users/sanchagrins/Library/Application Support/Sublime Text 3/Packages/User/Plain text.sublime-settings" + ], + "find": + { + "height": 0.0 + }, + "find_in_files": + { + "height": 0.0, + "where_history": + [ + ] + }, + "find_state": + { + "case_sensitive": false, + "find_history": + [ + ], + "highlight": true, + "in_selection": false, + "preserve_case": false, + "regex": false, + "replace_history": + [ + ], + "reverse": false, + "show_context": true, + "use_buffer2": true, + "whole_word": false, + "wrap": true + }, + "groups": + [ + { + "selected": 0, + "sheets": + [ + { + "buffer": 0, + "file": "slack_invite", + "semi_transient": false, + "settings": + { + "buffer_size": 0, + "regions": + { + }, + "selection": + [ + [ + 0, + 0 + ] + ], + "settings": + { + "syntax": "Packages/Text/Plain text.tmLanguage" + }, + "translation.x": 0.0, + "translation.y": 0.0, + "zoom_level": 1.0 + }, + "stack_index": 0, + "type": "text" + } + ] + } + ], + "incremental_find": + { + "height": 0.0 + }, + "input": + { + "height": 0.0 + }, + "layout": + { + "cells": + [ + [ + 0, + 0, + 1, + 1 + ] + ], + "cols": + [ + 0.0, + 1.0 + ], + "rows": + [ + 0.0, + 1.0 + ] + }, + "menu_visible": true, + "output.find_results": + { + "height": 0.0 + }, + "pinned_build_system": "", + "project": "SlackInvite.sublime-project", + "replace": + { + "height": 0.0 + }, + "save_all_on_build": true, + "select_file": + { + "height": 0.0, + "last_filter": "", + "selected_items": + [ + ], + "width": 0.0 + }, + "select_project": + { + "height": 0.0, + "last_filter": "", + "selected_items": + [ + ], + "width": 0.0 + }, + "select_symbol": + { + "height": 0.0, + "last_filter": "", + "selected_items": + [ + ], + "width": 0.0 + }, + "selected_group": 0, + "settings": + { + }, + "show_minimap": true, + "show_open_files": false, + "show_tabs": true, + "side_bar_visible": false, + "side_bar_width": 150.0, + "status_bar_visible": true, + "template_settings": + { + } +} diff --git a/functional_tests/all_user.py b/functional_tests/all_user.py new file mode 100644 index 0000000..02a2524 --- /dev/null +++ b/functional_tests/all_user.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from selenium import webdriver +import unittest + +class NewVisitorTest(unittest.TestCase): + + def setUp(self): + self.browser = webdriver.Firefox() + self.browser.implicitly_wait(3) + + def tearDown(self): + self.browser.quit() + + def test_it_worked(self): + self.browser.get('http://localhost:8000') + self.assertIn('Welcome to Django', self.browser.title) + +if __name__ == '__main__': + unittest.main(warnings='ignore') diff --git a/functional_tests/geckodriver.log b/functional_tests/geckodriver.log new file mode 100644 index 0000000..5731de9 --- /dev/null +++ b/functional_tests/geckodriver.log @@ -0,0 +1,15 @@ +1500889038295 geckodriver INFO Listening on 127.0.0.1:61943 +1500889039978 geckodriver::marionette INFO Starting browser /Applications/Firefox.app/Contents/MacOS/firefox-bin with args ["-marionette"] +1500889050402 Marionette INFO Listening on port 61956 +1500889050626 Marionette WARN TLS certificate errors will be ignored for this session +1500889050986 Marionette DEBUG loaded listener.js +2017-07-24 18:37:31.188 plugin-container[55143:9146832] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x943b, name = 'com.apple.tsm.portname' +See /usr/include/servers/bootstrap_defs.h for the error codes. +2017-07-24 18:37:31.190 plugin-container[55143:9146832] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x9703, name = 'com.apple.CFPasteboardClient' +See /usr/include/servers/bootstrap_defs.h for the error codes. +1500889051213 Marionette DEBUG Received DOM event "beforeunload" for "about:blank" +1500889051261 Marionette DEBUG Received DOM event "beforeunload" for "about:blank" +1500889051274 Marionette DEBUG Received DOM event "pagehide" for "about:blank" +1500889051274 Marionette DEBUG Received DOM event "unload" for "about:blank" +1500889051492 Marionette DEBUG Received DOM event "DOMContentLoaded" for "about:neterror?e=connectionFailure&u=http%3A//localhost%3A8000/&c=UTF-8&f=regular&d=Firefox%20can%E2%80%99t%20establish%20a%20connection%20to%20the%20server%20at%20localhost%3A8000." +1500889051536 Marionette INFO New connections will no longer be accepted diff --git a/geckodriver.log b/geckodriver.log new file mode 100644 index 0000000..88a4b8d --- /dev/null +++ b/geckodriver.log @@ -0,0 +1,45 @@ +1500889214427 geckodriver INFO Listening on 127.0.0.1:62277 +1500889215668 geckodriver::marionette INFO Starting browser /Applications/Firefox.app/Contents/MacOS/firefox-bin with args ["-marionette"] +1500889219841 Marionette INFO Listening on port 62290 +1500889219904 Marionette WARN TLS certificate errors will be ignored for this session +1500889220161 Marionette DEBUG loaded listener.js +1500889220223 Marionette DEBUG Received DOM event "beforeunload" for "about:blank" +2017-07-24 18:40:20.268 plugin-container[55220:9155425] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x920b, name = 'com.apple.tsm.portname' +See /usr/include/servers/bootstrap_defs.h for the error codes. +2017-07-24 18:40:20.270 plugin-container[55220:9155425] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x9903, name = 'com.apple.CFPasteboardClient' +See /usr/include/servers/bootstrap_defs.h for the error codes. +1500889220525 Marionette DEBUG Received DOM event "pagehide" for "about:blank" +1500889220525 Marionette DEBUG Received DOM event "unload" for "about:blank" +1500889220532 Marionette DEBUG Received DOM event "DOMContentLoaded" for "http://localhost:8000/" +1500889220619 Marionette DEBUG Received DOM event "pageshow" for "http://localhost:8000/" +1500889220686 Marionette INFO New connections will no longer be accepted +1500890712524 geckodriver INFO Listening on 127.0.0.1:62481 +1500890713892 geckodriver::marionette INFO Starting browser /Applications/Firefox.app/Contents/MacOS/firefox-bin with args ["-marionette"] +1500890718547 Marionette INFO Listening on port 62494 +1500890718646 Marionette WARN TLS certificate errors will be ignored for this session +1500890718913 Marionette DEBUG loaded listener.js +2017-07-24 19:05:19.000 plugin-container[55390:9200545] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x943b, name = 'com.apple.tsm.portname' +See /usr/include/servers/bootstrap_defs.h for the error codes. +2017-07-24 19:05:19.004 plugin-container[55390:9200545] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x9803, name = 'com.apple.CFPasteboardClient' +See /usr/include/servers/bootstrap_defs.h for the error codes. +1500890719015 Marionette DEBUG Received DOM event "beforeunload" for "about:blank" +1500890719076 Marionette DEBUG Received DOM event "pagehide" for "about:blank" +1500890719076 Marionette DEBUG Received DOM event "unload" for "about:blank" +1500890719083 Marionette DEBUG Received DOM event "DOMContentLoaded" for "http://localhost:8000/" +1500890719117 Marionette DEBUG Received DOM event "pageshow" for "http://localhost:8000/" +1500890719305 Marionette INFO New connections will no longer be accepted +1500899543110 geckodriver INFO Listening on 127.0.0.1:63279 +1500899544698 geckodriver::marionette INFO Starting browser /Applications/Firefox.app/Contents/MacOS/firefox-bin with args ["-marionette"] +1500899556339 Marionette INFO Listening on port 63292 +2017-07-24 21:32:36.747 plugin-container[56308:9260936] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x943b, name = 'com.apple.tsm.portname' +See /usr/include/servers/bootstrap_defs.h for the error codes. +2017-07-24 21:32:36.750 plugin-container[56308:9260936] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x9703, name = 'com.apple.CFPasteboardClient' +See /usr/include/servers/bootstrap_defs.h for the error codes. +1500899557008 Marionette WARN TLS certificate errors will be ignored for this session +1500899557063 Marionette DEBUG loaded listener.js +1500899557262 Marionette DEBUG Received DOM event "beforeunload" for "about:blank" +1500899557625 Marionette DEBUG Received DOM event "pagehide" for "about:blank" +1500899557625 Marionette DEBUG Received DOM event "unload" for "about:blank" +1500899557641 Marionette DEBUG Received DOM event "DOMContentLoaded" for "http://localhost:8000/" +1500899557923 Marionette DEBUG Received DOM event "pageshow" for "http://localhost:8000/" +1500899558724 Marionette INFO New connections will no longer be accepted diff --git a/slack_invite/manage.py b/slack_invite/manage.py new file mode 100755 index 0000000..707726e --- /dev/null +++ b/slack_invite/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "slack_invite.settings") + try: + from django.core.management import execute_from_command_line + except ImportError: + # The above import may fail for some other reason. Ensure that the + # issue is really that Django is missing to avoid masking other + # exceptions on Python 2. + try: + import django + except ImportError: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) + raise + execute_from_command_line(sys.argv) diff --git a/slack_invite/requirements/base.txt b/slack_invite/requirements/base.txt new file mode 100644 index 0000000..adf398f --- /dev/null +++ b/slack_invite/requirements/base.txt @@ -0,0 +1,2 @@ +Django==1.11.3 +pytz==2017.2 diff --git a/slack_invite/requirements/development.txt b/slack_invite/requirements/development.txt new file mode 100644 index 0000000..a3e81b8 --- /dev/null +++ b/slack_invite/requirements/development.txt @@ -0,0 +1 @@ +-r base.txt diff --git a/slack_invite/requirements/testing.txt b/slack_invite/requirements/testing.txt new file mode 100644 index 0000000..e6d8a7e --- /dev/null +++ b/slack_invite/requirements/testing.txt @@ -0,0 +1,2 @@ +-r base.txt +selenium==3.4.3 diff --git a/slack_invite/slack_invite/__init__.py b/slack_invite/slack_invite/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/slack_invite/slack_invite/settings/__init__.py b/slack_invite/slack_invite/settings/__init__.py new file mode 100644 index 0000000..b628a44 --- /dev/null +++ b/slack_invite/slack_invite/settings/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from .base import * diff --git a/slack_invite/slack_invite/settings/base.py b/slack_invite/slack_invite/settings/base.py new file mode 100644 index 0000000..9b4c17c --- /dev/null +++ b/slack_invite/slack_invite/settings/base.py @@ -0,0 +1,128 @@ +""" +Django settings for slack_invite project. + +Generated by 'django-admin startproject' using Django 1.11.3. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.11/ref/settings/ +""" + +import os +from django.core.exceptions import ImproperlyConfigured + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +def get_env_variable(var_name): + try: + return os.environ[var_name] + except KeyError: + error_msg = "Set the %s environment variable" % var_name + raise ImproperlyConfigured(error_msg) + +SECRET_KEY = get_env_variable('SECRET_KEY') + +# SECURITY WARNING: don't run with debug turned on in production! +#DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'slack_invite.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'slack_invite.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.11/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/1.11/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.11/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/slack_invite/slack_invite/settings/development.py b/slack_invite/slack_invite/settings/development.py new file mode 100644 index 0000000..4721806 --- /dev/null +++ b/slack_invite/slack_invite/settings/development.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +from .base import * + +DEBUG = True diff --git a/slack_invite/slack_invite/settings/production.py b/slack_invite/slack_invite/settings/production.py new file mode 100644 index 0000000..0c0c0be --- /dev/null +++ b/slack_invite/slack_invite/settings/production.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +from .base import * + +DEBUG = False diff --git a/slack_invite/slack_invite/settings/testing.py b/slack_invite/slack_invite/settings/testing.py new file mode 100644 index 0000000..4721806 --- /dev/null +++ b/slack_invite/slack_invite/settings/testing.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +from .base import * + +DEBUG = True diff --git a/slack_invite/slack_invite/urls.py b/slack_invite/slack_invite/urls.py new file mode 100644 index 0000000..3e8b561 --- /dev/null +++ b/slack_invite/slack_invite/urls.py @@ -0,0 +1,21 @@ +"""slack_invite URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/1.11/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.conf.urls import url, include + 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) +""" +from django.conf.urls import url +from django.contrib import admin + +urlpatterns = [ + url(r'^admin/', admin.site.urls), +] diff --git a/slack_invite/slack_invite/wsgi.py b/slack_invite/slack_invite/wsgi.py new file mode 100644 index 0000000..521a7c2 --- /dev/null +++ b/slack_invite/slack_invite/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for slack_invite project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "slack_invite.settings") + +application = get_wsgi_application()