From 0ae16edee574bb1b4f277dffe4e0c7115ac1786f Mon Sep 17 00:00:00 2001 From: erivanio Date: Fri, 26 Jan 2018 10:28:57 -0200 Subject: [PATCH] :tada: initial structure --- .gitignore | 3 + Pipfile | 21 +++++ Pipfile.lock | 197 ++++++++++++++++++++++++++++++++++++++++++ src/babel/__init__.py | 0 src/babel/settings.py | 117 +++++++++++++++++++++++++ src/babel/urls.py | 6 ++ src/babel/wsgi.py | 14 +++ src/manage.py | 15 ++++ 8 files changed, 373 insertions(+) create mode 100644 Pipfile create mode 100644 Pipfile.lock create mode 100644 src/babel/__init__.py create mode 100644 src/babel/settings.py create mode 100644 src/babel/urls.py create mode 100644 src/babel/wsgi.py create mode 100755 src/manage.py diff --git a/.gitignore b/.gitignore index 7bbc71c..090cc23 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +*/public/ +*.sqlite3 + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..351d79a --- /dev/null +++ b/Pipfile @@ -0,0 +1,21 @@ +[[source]] + +url = "https://pypi.python.org/simple" +verify_ssl = true +name = "pypi" + + +[dev-packages] + +ipdb = "*" + + +[packages] + +django = "*" +python-decouple = "*" + + +[requires] + +python_version = "3.6" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..f544ad4 --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,197 @@ +{ + "_meta": { + "hash": { + "sha256": "09c5eb73d7f77c78f2c22e784da451c355f5fd0681d71d37ff941b4ad0aad3ed" + }, + "host-environment-markers": { + "implementation_name": "cpython", + "implementation_version": "3.6.3", + "os_name": "posix", + "platform_machine": "x86_64", + "platform_python_implementation": "CPython", + "platform_release": "4.13.0-25-generic", + "platform_system": "Linux", + "platform_version": "#29-Ubuntu SMP Mon Jan 8 21:14:41 UTC 2018", + "python_full_version": "3.6.3", + "python_version": "3.6", + "sys_platform": "linux" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.6" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.python.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "django": { + "hashes": [ + "sha256:52475f607c92035d4ac8fee284f56213065a4a6b25ed43f7e39df0e576e69e9f", + "sha256:d96b804be412a5125a594023ec524a2010a6ffa4d408e5482ab6ff3cb97ec12f" + ], + "version": "==2.0.1" + }, + "python-decouple": { + "hashes": [ + "sha256:1317df14b43efee4337a4aa02914bf004f010cd56d6c4bd894e6474ec8c4fe2d" + ], + "version": "==3.1" + }, + "pytz": { + "hashes": [ + "sha256:80af0f3008046b9975242012a985f04c5df1f01eed4ec1633d56cc47a75a6a48", + "sha256:feb2365914948b8620347784b6b6da356f31c9d03560259070b2f30cff3d469d", + "sha256:59707844a9825589878236ff2f4e0dc9958511b7ffaae94dc615da07d4a68d33", + "sha256:d0ef5ef55ed3d37854320d4926b04a4cb42a2e88f71da9ddfdacfde8e364f027", + "sha256:c41c62827ce9cafacd6f2f7018e4f83a6f1986e87bfd000b8cfbd4ab5da95f1a", + "sha256:8cc90340159b5d7ced6f2ba77694d946fc975b09f1a51d93f3ce3bb399396f94", + "sha256:dd2e4ca6ce3785c8dd342d1853dd9052b19290d5bf66060846e5dc6b8d6667f7", + "sha256:699d18a2a56f19ee5698ab1123bbcc1d269d061996aeb1eda6d89248d3542b82", + "sha256:fae4cffc040921b8a2d60c6cf0b5d662c1190fe54d718271db4eb17d44a185b7" + ], + "version": "==2017.3" + } + }, + "develop": { + "backports.shutil-get-terminal-size": { + "hashes": [ + "sha256:0975ba55054c15e346944b38956a4c9cbee9009391e41b86c68990effb8c1f64", + "sha256:713e7a8228ae80341c70586d1cc0a8caa5207346927e23d09dcbcaf18eadec80" + ], + "markers": "python_version == '2.7'", + "version": "==1.0.0" + }, + "decorator": { + "hashes": [ + "sha256:94d1d8905f5010d74bbbd86c30471255661a14187c45f8d7f3e5aa8540fdb2e5", + "sha256:7d46dd9f3ea1cf5f06ee0e4e1277ae618cf48dfb10ada7c8427cd46c42702a0e" + ], + "version": "==4.2.1" + }, + "enum34": { + "hashes": [ + "sha256:6bd0f6ad48ec2aa117d3d141940d484deccda84d4fcd884f5c3d93c23ecd8c79", + "sha256:644837f692e5f550741432dd3f223bbb9852018674981b1664e5dc339387588a", + "sha256:8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1", + "sha256:2d81cbbe0e73112bdfe6ef8576f2238f2ba27dd0d55752a776c41d38b7da2850" + ], + "markers": "python_version == '2.7'", + "version": "==1.1.6" + }, + "ipdb": { + "hashes": [ + "sha256:9ea256b4280fbe12840fb9dfc3ce498c6c6de03352eca293e4400b0dfbed2b28" + ], + "version": "==0.10.3" + }, + "ipython": { + "hashes": [ + "sha256:578e2f3d779ed130a3cfefc09b2eb965a81457f6a31a25cd38e0bab622d4777d", + "sha256:185ef2093dbac6d7250fe9ed4d4dd0f18f10d0a6ac6169f3eeb2ff0663d96b92", + "sha256:66469e894d1f09d14a1f23b971a410af131daa9ad2a19922082e02e0ddfd150f" + ], + "version": "==5.5.0" + }, + "ipython-genutils": { + "hashes": [ + "sha256:72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8", + "sha256:eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8" + ], + "version": "==0.2.0" + }, + "pathlib2": { + "hashes": [ + "sha256:db3e43032d23787d3e9aec8c7ef1e0d2c3c589d5f303477661ebda2ca6d4bfba", + "sha256:d32550b75a818b289bd4c1f96b60c89957811da205afcceab75bc8b4857ea5b3" + ], + "markers": "python_version == '2.7' or python_version == '3.3'", + "version": "==2.3.0" + }, + "pexpect": { + "hashes": [ + "sha256:144939a072a46d32f6e5ecc866509e1d613276781f7182148a08df52eaa7b022", + "sha256:8e287b171dbaf249d0b06b5f2e88cb7e694651d2d0b8c15bccb83170d3c55575" + ], + "markers": "sys_platform != 'win32'", + "version": "==4.3.1" + }, + "pickleshare": { + "hashes": [ + "sha256:c9a2541f25aeabc070f12f452e1f2a8eae2abd51e1cd19e8430402bdf4c1d8b5", + "sha256:84a9257227dfdd6fe1b4be1319096c20eb85ff1e82c7932f36efccfe1b09737b" + ], + "version": "==0.7.4" + }, + "prompt-toolkit": { + "hashes": [ + "sha256:3f473ae040ddaa52b52f97f6b4a493cfa9f5920c255a12dc56a7d34397a398a4", + "sha256:1df952620eccb399c53ebb359cc7d9a8d3a9538cb34c5a1344bdbeb29fbcc381", + "sha256:858588f1983ca497f1cf4ffde01d978a3ea02b01c8a26a8bbc5cd2e66d816917" + ], + "version": "==1.0.15" + }, + "ptyprocess": { + "hashes": [ + "sha256:e8c43b5eee76b2083a9badde89fd1bbce6c8942d1045146e100b7b5e014f4f1a", + "sha256:e64193f0047ad603b71f202332ab5527c5e52aa7c8b609704fc28c0dc20c4365" + ], + "version": "==0.5.2" + }, + "pygments": { + "hashes": [ + "sha256:78f3f434bcc5d6ee09020f92ba487f95ba50f1e3ef83ae96b9d5ffa1bab25c5d", + "sha256:dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc" + ], + "version": "==2.2.0" + }, + "scandir": { + "hashes": [ + "sha256:913d0d04f3ea8f38a52a38e930a08deacd3643d71875a0751a5c01e006102998", + "sha256:eb9d4a55bbeb0473a9c7d3ff81e12d44f0ad86daff48b02a95e2398c87ff1a00", + "sha256:2b28d118b372de8950f85b65d8ddfd43643f139a5b721281dd6532bed6b8321c", + "sha256:f14476800cfdd6809d5130840f78ca3c08aa25544113e2b33a0b2fe914583d69", + "sha256:6db5aadb667bb709cc23921203e9c27f08225506a9b84b7ebe2b645dee47a4dd", + "sha256:8129fe7b9211d080457e0ff87397d85bb9be6ebb482b6be6ad9700059ac2e516", + "sha256:8fe782abf9314f2733c09d2191c1b3047475218ddbae90052b5c0f1a4215d5e2", + "sha256:a93b6cc872eeccdc91b4c1c1e510820bee17f79c9455064fb8d3b73b51e52024", + "sha256:9851e782da220073093da68b3451e3c33b10f84eca2aec17a24661c7c63357a2", + "sha256:937d27e367af994afd3792904b794a82645ea9616dd336f5030e0b50e527eb57", + "sha256:e0278a2d4bc6c0569aedbe66bf26c8ab5b2b08378b3289de49257f23ac624338" + ], + "markers": "python_version < '3.5'", + "version": "==1.6" + }, + "simplegeneric": { + "hashes": [ + "sha256:dc972e06094b9af5b855b3df4a646395e43d1c9d0d39ed345b7393560d0b9173" + ], + "version": "==0.8.1" + }, + "six": { + "hashes": [ + "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb", + "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9" + ], + "version": "==1.11.0" + }, + "traitlets": { + "hashes": [ + "sha256:c6cb5e6f57c5a9bdaa40fa71ce7b4af30298fbab9ece9815b5d995ab6217c7d9", + "sha256:9c4bd2d267b7153df9152698efb1050a5d84982d3384a37b2c1f7723ba3e7835" + ], + "version": "==4.3.2" + }, + "wcwidth": { + "hashes": [ + "sha256:f4ebe71925af7b40a864553f761ed559b43544f8f71746c2d756c7fe788ade7c", + "sha256:3df37372226d6e63e1b1e1eda15c594bca98a22d33a23832a90998faa96bc65e" + ], + "version": "==0.1.7" + } + } +} diff --git a/src/babel/__init__.py b/src/babel/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/babel/settings.py b/src/babel/settings.py new file mode 100644 index 0000000..60a8bc8 --- /dev/null +++ b/src/babel/settings.py @@ -0,0 +1,117 @@ +from decouple import config, Csv +import os + +BASE_DIR = os.path.dirname(os.path.dirname(__file__)) + +# APPLICATION SETTINGS +DEBUG = config('DEBUG', cast=bool, default=True) +SECRET_KEY = config('SECRET_KEY', default='secret_key') + +SITE_ID = 1 +ALLOWED_HOSTS = config('ALLOWED_HOSTS', + cast=Csv(lambda x: x.strip().strip(',').strip()), + default='*') + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.' + config('DATABASE_ENGINE', + default='sqlite3'), + 'NAME': config('DATABASE_NAME', + default=os.path.join(BASE_DIR, 'db.sqlite3')), + 'USER': config('DATABASE_USER', default=''), + 'PASSWORD': config('DATABASE_PASSWORD', default=''), + 'HOST': config('DATABASE_HOST', default=''), + 'PORT': config('DATABASE_PORT', default=''), + } +} + +ROOT_URLCONF = 'babel.urls' +WSGI_APPLICATION = 'babel.wsgi.application' + +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.locale.LocaleMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + +] + +# PASSWORD VALIDATION +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', + }, +] + +# AUTHENTICATION +AUTHENTICATION_BACKENDS = ( + 'django.contrib.auth.backends.ModelBackend', +) + +# INTERNATIONALIZATION +LANGUAGE_CODE = config('LANGUAGE_CODE', default='pt-br') +TIME_ZONE = config('TIME_ZONE', default='America/Sao_Paulo') +USE_I18N = True +USE_L10N = True +USE_TZ = True + +LOCALE_PATHS = [ + os.path.join(BASE_DIR, 'locale'), +] + +LANGUAGES = ( + ('en', 'English'), + ('pt-br', 'Brazilian Portuguese'), +) + +# STATICFILES SETTINGS +STATIC_URL = config('STATIC_URL', default='/static/') +STATIC_ROOT = os.path.abspath(os.path.join(BASE_DIR, 'public', 'static')) + +STATICFILES_DIRS = [ + os.path.join(BASE_DIR, 'static'), +] + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [ + os.path.join(BASE_DIR, 'templates'), + ], + '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', + ], + }, + }, +] diff --git a/src/babel/urls.py b/src/babel/urls.py new file mode 100644 index 0000000..a859c04 --- /dev/null +++ b/src/babel/urls.py @@ -0,0 +1,6 @@ +from django.urls import path +from django.contrib import admin + +urlpatterns = [ + path('admin/', admin.site.urls), +] diff --git a/src/babel/wsgi.py b/src/babel/wsgi.py new file mode 100644 index 0000000..2bc90e7 --- /dev/null +++ b/src/babel/wsgi.py @@ -0,0 +1,14 @@ +""" +WSGI config for babel 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.7/howto/deployment/wsgi/ +""" + +import os +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "babel.settings") + +from django.core.wsgi import get_wsgi_application +application = get_wsgi_application() diff --git a/src/manage.py b/src/manage.py new file mode 100755 index 0000000..1f058cc --- /dev/null +++ b/src/manage.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "babel.settings") + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + 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?" + ) from exc + execute_from_command_line(sys.argv)