Skip to content

Commit

Permalink
🎉 initial structure
Browse files Browse the repository at this point in the history
  • Loading branch information
erivanio committed Jan 26, 2018
1 parent 35b7849 commit 0ae16ed
Show file tree
Hide file tree
Showing 8 changed files with 373 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
*/public/
*.sqlite3

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
21 changes: 21 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -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"
197 changes: 197 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added src/babel/__init__.py
Empty file.
117 changes: 117 additions & 0 deletions src/babel/settings.py
Original file line number Diff line number Diff line change
@@ -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',
],
},
},
]
6 changes: 6 additions & 0 deletions src/babel/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.urls import path
from django.contrib import admin

urlpatterns = [
path('admin/', admin.site.urls),
]
14 changes: 14 additions & 0 deletions src/babel/wsgi.py
Original file line number Diff line number Diff line change
@@ -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()
15 changes: 15 additions & 0 deletions src/manage.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 0ae16ed

Please sign in to comment.