├── .gitignore ├── LICENSE ├── README.md ├── django16 ├── .gitignore ├── README.md ├── apps │ ├── README.md │ └── __init__.py ├── conf │ ├── nginx.conf │ └── supervisor.conf ├── manage.py ├── media │ └── README.md ├── project_name │ ├── __init__.py │ ├── settings.py │ ├── settings_local.py.example │ ├── settings_production.py │ ├── urls.py │ └── wsgi.py ├── requirements.txt ├── runtests.sh ├── static │ └── README.md └── templates │ └── README.md ├── django17 ├── .gitignore ├── README.md ├── apps │ ├── README.md │ └── __init__.py ├── conf │ ├── nginx.conf │ └── supervisor.conf ├── manage.py ├── media │ └── README.md ├── project_name │ ├── __init__.py │ ├── settings.py │ ├── settings_local.py.example │ ├── settings_production.py │ ├── urls.py │ └── wsgi.py ├── requirements.txt ├── runtests.sh ├── static │ └── README.md └── templates │ └── README.md └── django18 ├── README.md ├── apps ├── README.md └── __init__.py ├── conf ├── nginx.conf └── supervisor.conf ├── manage.py ├── media └── README.md ├── project_name ├── __init__.py ├── settings.py ├── settings_local.py.example ├── settings_production.py ├── urls.py └── wsgi.py ├── requirements.txt ├── runtests.sh ├── static └── README.md └── templates └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.swp 3 | *.sqlite3 4 | settings_local.py 5 | .DS_Store 6 | .coverage 7 | #media/* 8 | #static/* 9 | __pycache__ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Allisson Azevedo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | django-project-template 2 | ======================= 3 | 4 | Project template for django 1.6/1.7/1.8. 5 | 6 | # How to install 7 | See README.md in django1.x directory. 8 | -------------------------------------------------------------------------------- /django16/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.swp 3 | *.sqlite3 4 | settings_local.py 5 | .DS_Store 6 | .coverage 7 | #media/* 8 | #static/* 9 | __pycache__ -------------------------------------------------------------------------------- /django16/README.md: -------------------------------------------------------------------------------- 1 | Clone this repo first! 2 | 3 | # How to install 4 | 5 | django-admin.py startproject --template=your-path/django-project-template/django16 --extension conf your_project_name 6 | cd your_project_name 7 | pip install -r requirements.txt 8 | -------------------------------------------------------------------------------- /django16/apps/README.md: -------------------------------------------------------------------------------- 1 | apps 2 | ==== 3 | 4 | This is the directory for project apps. -------------------------------------------------------------------------------- /django16/apps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/allisson/django-project-template/2515d7a4f0964feb8aef2f340db4aa2f820c1d87/django16/apps/__init__.py -------------------------------------------------------------------------------- /django16/conf/nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name {{ project_name }}; 4 | access_log /var/log/nginx/{{ project_name }}.log; 5 | client_max_body_size 10m; 6 | 7 | location /static/ { 8 | alias /deploy/sites/{{ project_name }}/static/; 9 | expires 30d; 10 | } 11 | 12 | location /media/ { 13 | alias /deploy/sites/{{ project_name }}/media/; 14 | expires 30d; 15 | } 16 | 17 | location / { 18 | proxy_pass http://127.0.0.1:9001; 19 | proxy_set_header Host $host; 20 | proxy_set_header X-Real-IP $remote_addr; 21 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /django16/conf/supervisor.conf: -------------------------------------------------------------------------------- 1 | [program:{{ project_name }}] 2 | command=/deploy/virtualenvs/{{ project_name }}/bin/gunicorn {{ project_name }}.wsgi -b 127.0.0.1:9001 -p /deploy/sites/{{ project_name }}/gunicorn.pid 3 | directory=/deploy/sites/{{ project_name }} 4 | user={{ project_name }} 5 | autostart=true 6 | autorestart=true 7 | redirect_stderr=True 8 | environment=DJANGO_SETTINGS_MODULE="{{ project_name }}.settings_production", LANG="en_US.utf8", LC_ALL="en_US.UTF-8", LC_LANG="en_US.UTF-8" -------------------------------------------------------------------------------- /django16/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") 7 | 8 | from django.core.management import execute_from_command_line 9 | 10 | execute_from_command_line(sys.argv) 11 | -------------------------------------------------------------------------------- /django16/media/README.md: -------------------------------------------------------------------------------- 1 | media 2 | ===== 3 | 4 | This directory is used for uploads. 5 | 6 | It's available via /media/ url when DEBUG=True. -------------------------------------------------------------------------------- /django16/project_name/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/allisson/django-project-template/2515d7a4f0964feb8aef2f340db4aa2f820c1d87/django16/project_name/__init__.py -------------------------------------------------------------------------------- /django16/project_name/settings.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | """ 4 | Django settings for {{ project_name }} project. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.6/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/1.6/ref/settings/ 11 | """ 12 | 13 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 14 | import os 15 | BASE_DIR = os.path.dirname(os.path.dirname(__file__)) 16 | 17 | 18 | # Quick-start development settings - unsuitable for production 19 | # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ 20 | 21 | # SECURITY WARNING: keep the secret key used in production secret! 22 | SECRET_KEY = '{{ secret_key }}' 23 | 24 | # SECURITY WARNING: don't run with debug turned on in production! 25 | DEBUG = True 26 | 27 | TEMPLATE_DEBUG = True 28 | 29 | ALLOWED_HOSTS = [ 30 | '*', 31 | ] 32 | 33 | 34 | # Application definition 35 | 36 | INSTALLED_APPS = ( 37 | # django core 38 | 'django.contrib.admin', 39 | 'django.contrib.auth', 40 | 'django.contrib.contenttypes', 41 | 'django.contrib.sessions', 42 | 'django.contrib.messages', 43 | 'django.contrib.staticfiles', 44 | # third party apps 45 | # local apps 46 | # south in the end 47 | 'south', 48 | ) 49 | 50 | MIDDLEWARE_CLASSES = ( 51 | 'django.contrib.sessions.middleware.SessionMiddleware', 52 | 'django.middleware.common.CommonMiddleware', 53 | 'django.middleware.csrf.CsrfViewMiddleware', 54 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 55 | 'django.contrib.messages.middleware.MessageMiddleware', 56 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 57 | ) 58 | 59 | ROOT_URLCONF = '{{ project_name }}.urls' 60 | 61 | WSGI_APPLICATION = '{{ project_name }}.wsgi.application' 62 | 63 | 64 | # Database 65 | # https://docs.djangoproject.com/en/1.6/ref/settings/#databases 66 | 67 | DATABASES = { 68 | 'default': { 69 | 'ENGINE': 'django.db.backends.sqlite3', 70 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 71 | } 72 | } 73 | 74 | # Internationalization 75 | # https://docs.djangoproject.com/en/1.6/topics/i18n/ 76 | 77 | LANGUAGE_CODE = 'en-us' 78 | 79 | TIME_ZONE = 'UTC' 80 | 81 | USE_I18N = True 82 | 83 | USE_L10N = True 84 | 85 | USE_TZ = True 86 | 87 | 88 | # Static files (CSS, JavaScript, Images) 89 | # https://docs.djangoproject.com/en/1.6/howto/static-files/ 90 | 91 | STATIC_URL = '/static/' 92 | 93 | # ============================================================================= 94 | # Django Local settings here 95 | # ============================================================================= 96 | 97 | ADMINS = ( 98 | ('John Doe', 'johndoe@email.com'), 99 | ) 100 | 101 | EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' 102 | 103 | MEDIA_ROOT = os.path.join(BASE_DIR, 'media') 104 | 105 | MEDIA_URL = '/media/' 106 | 107 | STATIC_ROOT = os.path.join(BASE_DIR, 'static') 108 | 109 | TEMPLATE_CONTEXT_PROCESSORS = ( 110 | 'django.contrib.auth.context_processors.auth', 111 | 'django.core.context_processors.debug', 112 | 'django.core.context_processors.i18n', 113 | 'django.core.context_processors.media', 114 | 'django.core.context_processors.static', 115 | 'django.core.context_processors.tz', 116 | 'django.contrib.messages.context_processors.messages', 117 | 'django.core.context_processors.request', 118 | ) 119 | 120 | TEMPLATE_DIRS = ( 121 | os.path.join(BASE_DIR, 'templates'), 122 | ) 123 | 124 | # ============================================================================= 125 | # {{ project_name }} settings here 126 | # ============================================================================= 127 | 128 | SITE_NAME = '{{ project_name }}' 129 | SITE_DOMAIN = '{{ project_name }}.com' 130 | 131 | # ============================================================================= 132 | # Load settings_local.py if exists 133 | # ============================================================================= 134 | try: 135 | from .settings_local import * 136 | except ImportError: 137 | pass 138 | -------------------------------------------------------------------------------- /django16/project_name/settings_local.py.example: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | DATABASES = { 5 | 'default': { 6 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', 7 | 'NAME': 'yourproject', 8 | 'USER': 'youruser', 9 | 'PASSWORD': 'yourpassword', 10 | 'HOST': '', 11 | 'PORT': '', 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /django16/project_name/settings_production.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | from settings import * 4 | 5 | DEBUG = False 6 | 7 | EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' 8 | 9 | DATABASES = { 10 | 'default': { 11 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', 12 | 'NAME': '{{ project_name }}', 13 | 'USER': '{{ project_name }}', 14 | 'PASSWORD': '{{ project_name }}', 15 | 'HOST': '', 16 | 'PORT': '', 17 | } 18 | } 19 | 20 | STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.CachedStaticFilesStorage' 21 | -------------------------------------------------------------------------------- /django16/project_name/urls.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | from django.conf.urls import patterns, include, url 4 | from django.contrib import admin 5 | from django.conf import settings 6 | 7 | admin.autodiscover() 8 | 9 | urlpatterns = patterns( 10 | '', 11 | 12 | # admin 13 | url(r'^admin/', include(admin.site.urls)), 14 | ) 15 | 16 | if settings.DEBUG: 17 | urlpatterns += patterns( 18 | '', 19 | ( 20 | r'^media/(?P.*)$', 21 | 'django.views.static.serve', 22 | { 23 | 'document_root': settings.MEDIA_ROOT, 24 | 'show_indexes': True 25 | } 26 | ), 27 | ) 28 | -------------------------------------------------------------------------------- /django16/project_name/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for {{ project_name }} project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") 12 | 13 | from django.core.wsgi import get_wsgi_application 14 | application = get_wsgi_application() 15 | -------------------------------------------------------------------------------- /django16/requirements.txt: -------------------------------------------------------------------------------- 1 | Django<1.7 2 | Pillow>=2.9.0 3 | gunicorn>=19.3.0 4 | coverage>=3.7.1 5 | psycopg2>=2.5.2 6 | South>=1.0.2 7 | pytz>=2015.4 -------------------------------------------------------------------------------- /django16/runtests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | coverage run --source=apps manage.py test 3 | coverage report -m -------------------------------------------------------------------------------- /django16/static/README.md: -------------------------------------------------------------------------------- 1 | static 2 | ====== 3 | 4 | This directory is a container for all static files collected by collectstatic command. 5 | 6 | It's available via /static/ url when DEBUG=True. -------------------------------------------------------------------------------- /django16/templates/README.md: -------------------------------------------------------------------------------- 1 | templates 2 | ========= 3 | 4 | This is the directory for project template files. -------------------------------------------------------------------------------- /django17/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.swp 3 | *.sqlite3 4 | settings_local.py 5 | .DS_Store 6 | .coverage 7 | #media/* 8 | #static/* 9 | __pycache__ -------------------------------------------------------------------------------- /django17/README.md: -------------------------------------------------------------------------------- 1 | Clone this repo first! 2 | 3 | # How to install 4 | 5 | django-admin.py startproject --template=your-path/django-project-template/django17 --extension conf your_project_name 6 | cd your_project_name 7 | pip install -r requirements.txt 8 | -------------------------------------------------------------------------------- /django17/apps/README.md: -------------------------------------------------------------------------------- 1 | apps 2 | ==== 3 | 4 | This is the directory for project apps. -------------------------------------------------------------------------------- /django17/apps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/allisson/django-project-template/2515d7a4f0964feb8aef2f340db4aa2f820c1d87/django17/apps/__init__.py -------------------------------------------------------------------------------- /django17/conf/nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name {{ project_name }}; 4 | access_log /var/log/nginx/{{ project_name }}.log; 5 | client_max_body_size 10m; 6 | 7 | location /static/ { 8 | alias /deploy/sites/{{ project_name }}/static/; 9 | expires 30d; 10 | } 11 | 12 | location /media/ { 13 | alias /deploy/sites/{{ project_name }}/media/; 14 | expires 30d; 15 | } 16 | 17 | location / { 18 | proxy_pass http://127.0.0.1:9001; 19 | proxy_set_header Host $host; 20 | proxy_set_header X-Real-IP $remote_addr; 21 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /django17/conf/supervisor.conf: -------------------------------------------------------------------------------- 1 | [program:{{ project_name }}] 2 | command=/deploy/virtualenvs/{{ project_name }}/bin/gunicorn {{ project_name }}.wsgi -b 127.0.0.1:9001 -p /deploy/sites/{{ project_name }}/gunicorn.pid 3 | directory=/deploy/sites/{{ project_name }} 4 | user={{ project_name }} 5 | autostart=true 6 | autorestart=true 7 | redirect_stderr=True 8 | environment=DJANGO_SETTINGS_MODULE="{{ project_name }}.settings_production", LANG="en_US.utf8", LC_ALL="en_US.UTF-8", LC_LANG="en_US.UTF-8" -------------------------------------------------------------------------------- /django17/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") 7 | 8 | from django.core.management import execute_from_command_line 9 | 10 | execute_from_command_line(sys.argv) 11 | -------------------------------------------------------------------------------- /django17/media/README.md: -------------------------------------------------------------------------------- 1 | media 2 | ===== 3 | 4 | This directory is used for uploads. 5 | 6 | It's available via /media/ url when DEBUG=True. -------------------------------------------------------------------------------- /django17/project_name/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/allisson/django-project-template/2515d7a4f0964feb8aef2f340db4aa2f820c1d87/django17/project_name/__init__.py -------------------------------------------------------------------------------- /django17/project_name/settings.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | """ 4 | Django settings for {{ project_name }} project. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.7/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/1.7/ref/settings/ 11 | """ 12 | 13 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 14 | import os 15 | BASE_DIR = os.path.dirname(os.path.dirname(__file__)) 16 | 17 | 18 | # Quick-start development settings - unsuitable for production 19 | # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ 20 | 21 | # SECURITY WARNING: keep the secret key used in production secret! 22 | SECRET_KEY = '{{ secret_key }}' 23 | 24 | # SECURITY WARNING: don't run with debug turned on in production! 25 | DEBUG = True 26 | 27 | TEMPLATE_DEBUG = True 28 | 29 | ALLOWED_HOSTS = [ 30 | '*', 31 | ] 32 | 33 | 34 | # Application definition 35 | 36 | INSTALLED_APPS = ( 37 | # django core 38 | 'django.contrib.admin', 39 | 'django.contrib.auth', 40 | 'django.contrib.contenttypes', 41 | 'django.contrib.sessions', 42 | 'django.contrib.messages', 43 | 'django.contrib.staticfiles', 44 | # third party apps 45 | # local apps 46 | ) 47 | 48 | MIDDLEWARE_CLASSES = ( 49 | 'django.contrib.sessions.middleware.SessionMiddleware', 50 | 'django.middleware.common.CommonMiddleware', 51 | 'django.middleware.csrf.CsrfViewMiddleware', 52 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 53 | 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 54 | 'django.contrib.messages.middleware.MessageMiddleware', 55 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 56 | ) 57 | 58 | ROOT_URLCONF = '{{ project_name }}.urls' 59 | 60 | WSGI_APPLICATION = '{{ project_name }}.wsgi.application' 61 | 62 | 63 | # Database 64 | # https://docs.djangoproject.com/en/1.7/ref/settings/#databases 65 | 66 | DATABASES = { 67 | 'default': { 68 | 'ENGINE': 'django.db.backends.sqlite3', 69 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 70 | } 71 | } 72 | 73 | # Internationalization 74 | # https://docs.djangoproject.com/en/1.7/topics/i18n/ 75 | 76 | LANGUAGE_CODE = 'en-us' 77 | 78 | TIME_ZONE = 'UTC' 79 | 80 | USE_I18N = True 81 | 82 | USE_L10N = True 83 | 84 | USE_TZ = True 85 | 86 | 87 | # Static files (CSS, JavaScript, Images) 88 | # https://docs.djangoproject.com/en/1.7/howto/static-files/ 89 | 90 | STATIC_URL = '/static/' 91 | 92 | # ============================================================================= 93 | # Django Local settings here 94 | # ============================================================================= 95 | 96 | ADMINS = ( 97 | ('John Doe', 'johndoe@email.com'), 98 | ) 99 | 100 | EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' 101 | 102 | MEDIA_ROOT = os.path.join(BASE_DIR, 'media') 103 | 104 | MEDIA_URL = '/media/' 105 | 106 | STATIC_ROOT = os.path.join(BASE_DIR, 'static') 107 | 108 | TEMPLATE_CONTEXT_PROCESSORS = ( 109 | 'django.contrib.auth.context_processors.auth', 110 | 'django.core.context_processors.debug', 111 | 'django.core.context_processors.i18n', 112 | 'django.core.context_processors.media', 113 | 'django.core.context_processors.static', 114 | 'django.core.context_processors.tz', 115 | 'django.contrib.messages.context_processors.messages', 116 | 'django.core.context_processors.request', 117 | ) 118 | 119 | TEMPLATE_DIRS = ( 120 | os.path.join(BASE_DIR, 'templates'), 121 | ) 122 | 123 | # ============================================================================= 124 | # {{ project_name }} settings here 125 | # ============================================================================= 126 | 127 | SITE_NAME = '{{ project_name }}' 128 | SITE_DOMAIN = '{{ project_name }}.com' 129 | 130 | # ============================================================================= 131 | # Load settings_local.py if exists 132 | # ============================================================================= 133 | try: 134 | from .settings_local import * 135 | except ImportError: 136 | pass 137 | -------------------------------------------------------------------------------- /django17/project_name/settings_local.py.example: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | DATABASES = { 5 | 'default': { 6 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', 7 | 'NAME': 'yourproject', 8 | 'USER': 'youruser', 9 | 'PASSWORD': 'yourpassword', 10 | 'HOST': '', 11 | 'PORT': '', 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /django17/project_name/settings_production.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | from settings import * 4 | 5 | DEBUG = False 6 | 7 | EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' 8 | 9 | DATABASES = { 10 | 'default': { 11 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', 12 | 'NAME': '{{ project_name }}', 13 | 'USER': '{{ project_name }}', 14 | 'PASSWORD': '{{ project_name }}', 15 | 'HOST': '', 16 | 'PORT': '', 17 | } 18 | } 19 | 20 | STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.CachedStaticFilesStorage' 21 | -------------------------------------------------------------------------------- /django17/project_name/urls.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | from django.conf.urls import patterns, include, url 4 | from django.contrib import admin 5 | from django.conf import settings 6 | 7 | urlpatterns = patterns( 8 | '', 9 | 10 | # admin 11 | url(r'^admin/', include(admin.site.urls)), 12 | ) 13 | 14 | if settings.DEBUG: 15 | urlpatterns += patterns( 16 | '', 17 | ( 18 | r'^media/(?P.*)$', 19 | 'django.views.static.serve', 20 | { 21 | 'document_root': settings.MEDIA_ROOT, 22 | 'show_indexes': True 23 | } 24 | ), 25 | ) 26 | -------------------------------------------------------------------------------- /django17/project_name/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for {{ project_name }} project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") 12 | 13 | from django.core.wsgi import get_wsgi_application 14 | application = get_wsgi_application() 15 | -------------------------------------------------------------------------------- /django17/requirements.txt: -------------------------------------------------------------------------------- 1 | Django<1.8 2 | Pillow>=2.9.0 3 | gunicorn>=19.3.0 4 | coverage>=3.7.1 5 | psycopg2>=2.5.2 6 | pytz>=2015.4 -------------------------------------------------------------------------------- /django17/runtests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | coverage run --source=apps manage.py test 3 | coverage report -m -------------------------------------------------------------------------------- /django17/static/README.md: -------------------------------------------------------------------------------- 1 | static 2 | ====== 3 | 4 | This directory is a container for all static files collected by collectstatic command. 5 | 6 | It's available via /static/ url when DEBUG=True. -------------------------------------------------------------------------------- /django17/templates/README.md: -------------------------------------------------------------------------------- 1 | templates 2 | ========= 3 | 4 | This is the directory for project template files. -------------------------------------------------------------------------------- /django18/README.md: -------------------------------------------------------------------------------- 1 | Clone this repo first! 2 | 3 | # How to install 4 | 5 | django-admin.py startproject --template=your-path/django-project-template/django18 --extension conf your_project_name 6 | cd your_project_name 7 | pip install -r requirements.txt 8 | -------------------------------------------------------------------------------- /django18/apps/README.md: -------------------------------------------------------------------------------- 1 | apps 2 | ==== 3 | 4 | This is the directory for project apps. -------------------------------------------------------------------------------- /django18/apps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/allisson/django-project-template/2515d7a4f0964feb8aef2f340db4aa2f820c1d87/django18/apps/__init__.py -------------------------------------------------------------------------------- /django18/conf/nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name {{ project_name }}; 4 | access_log /var/log/nginx/{{ project_name }}.log; 5 | client_max_body_size 10m; 6 | 7 | location /static/ { 8 | alias /deploy/sites/{{ project_name }}/static/; 9 | expires 30d; 10 | } 11 | 12 | location /media/ { 13 | alias /deploy/sites/{{ project_name }}/media/; 14 | expires 30d; 15 | } 16 | 17 | location / { 18 | proxy_pass http://127.0.0.1:9001; 19 | proxy_set_header Host $host; 20 | proxy_set_header X-Real-IP $remote_addr; 21 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /django18/conf/supervisor.conf: -------------------------------------------------------------------------------- 1 | [program:{{ project_name }}] 2 | command=/deploy/virtualenvs/{{ project_name }}/bin/gunicorn {{ project_name }}.wsgi -b 127.0.0.1:9001 -p /deploy/sites/{{ project_name }}/gunicorn.pid 3 | directory=/deploy/sites/{{ project_name }} 4 | user={{ project_name }} 5 | autostart=true 6 | autorestart=true 7 | redirect_stderr=True 8 | environment=DJANGO_SETTINGS_MODULE="{{ project_name }}.settings_production", LANG="en_US.utf8", LC_ALL="en_US.UTF-8", LC_LANG="en_US.UTF-8" -------------------------------------------------------------------------------- /django18/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") 7 | 8 | from django.core.management import execute_from_command_line 9 | 10 | execute_from_command_line(sys.argv) 11 | -------------------------------------------------------------------------------- /django18/media/README.md: -------------------------------------------------------------------------------- 1 | media 2 | ===== 3 | 4 | This directory is used for uploads. 5 | 6 | It's available via /media/ url when DEBUG=True. -------------------------------------------------------------------------------- /django18/project_name/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/allisson/django-project-template/2515d7a4f0964feb8aef2f340db4aa2f820c1d87/django18/project_name/__init__.py -------------------------------------------------------------------------------- /django18/project_name/settings.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | """ 4 | Django settings for {{ project_name }} project. 5 | 6 | Generated by 'django-admin startproject' using Django 1.8.3. 7 | 8 | For more information on this file, see 9 | https://docs.djangoproject.com/en/1.8/topics/settings/ 10 | 11 | For the full list of settings and their values, see 12 | https://docs.djangoproject.com/en/1.8/ref/settings/ 13 | """ 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | import os 17 | 18 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 19 | 20 | 21 | # Quick-start development settings - unsuitable for production 22 | # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ 23 | 24 | # SECURITY WARNING: keep the secret key used in production secret! 25 | SECRET_KEY = '{{ secret_key }}' 26 | 27 | # SECURITY WARNING: don't run with debug turned on in production! 28 | DEBUG = True 29 | 30 | ALLOWED_HOSTS = [ 31 | '*', 32 | ] 33 | 34 | 35 | # Application definition 36 | 37 | INSTALLED_APPS = ( 38 | # django core 39 | 'django.contrib.admin', 40 | 'django.contrib.auth', 41 | 'django.contrib.contenttypes', 42 | 'django.contrib.sessions', 43 | 'django.contrib.messages', 44 | 'django.contrib.staticfiles', 45 | # third party apps 46 | # local apps 47 | ) 48 | 49 | MIDDLEWARE_CLASSES = ( 50 | 'django.contrib.sessions.middleware.SessionMiddleware', 51 | 'django.middleware.common.CommonMiddleware', 52 | 'django.middleware.csrf.CsrfViewMiddleware', 53 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 54 | 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 55 | 'django.contrib.messages.middleware.MessageMiddleware', 56 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 57 | 'django.middleware.security.SecurityMiddleware', 58 | ) 59 | 60 | ROOT_URLCONF = '{{ project_name }}.urls' 61 | 62 | TEMPLATES = [ 63 | { 64 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 65 | 'DIRS': [ 66 | os.path.join(BASE_DIR, 'templates'), 67 | ], 68 | 'APP_DIRS': True, 69 | 'OPTIONS': { 70 | 'context_processors': [ 71 | 'django.contrib.auth.context_processors.auth', 72 | 'django.template.context_processors.debug', 73 | 'django.template.context_processors.i18n', 74 | 'django.template.context_processors.media', 75 | 'django.template.context_processors.static', 76 | 'django.template.context_processors.tz', 77 | 'django.contrib.messages.context_processors.messages', 78 | 'django.template.context_processors.request', 79 | ], 80 | }, 81 | }, 82 | ] 83 | 84 | WSGI_APPLICATION = '{{ project_name }}.wsgi.application' 85 | 86 | 87 | # Database 88 | # https://docs.djangoproject.com/en/1.8/ref/settings/#databases 89 | 90 | DATABASES = { 91 | 'default': { 92 | 'ENGINE': 'django.db.backends.sqlite3', 93 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 94 | } 95 | } 96 | 97 | 98 | # Internationalization 99 | # https://docs.djangoproject.com/en/1.8/topics/i18n/ 100 | 101 | LANGUAGE_CODE = 'en-us' 102 | 103 | TIME_ZONE = 'UTC' 104 | 105 | USE_I18N = True 106 | 107 | USE_L10N = True 108 | 109 | USE_TZ = True 110 | 111 | 112 | # Static files (CSS, JavaScript, Images) 113 | # https://docs.djangoproject.com/en/1.8/howto/static-files/ 114 | 115 | STATIC_URL = '/static/' 116 | 117 | # ============================================================================= 118 | # Django Local settings here 119 | # ============================================================================= 120 | 121 | ADMINS = ( 122 | ('John Doe', 'johndoe@email.com'), 123 | ) 124 | 125 | EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' 126 | 127 | MEDIA_ROOT = os.path.join(BASE_DIR, 'media') 128 | 129 | MEDIA_URL = '/media/' 130 | 131 | STATIC_ROOT = os.path.join(BASE_DIR, 'static') 132 | 133 | # ============================================================================= 134 | # {{ project_name }} settings here 135 | # ============================================================================= 136 | 137 | SITE_NAME = '{{ project_name }}' 138 | SITE_DOMAIN = '{{ project_name }}.com' 139 | 140 | # ============================================================================= 141 | # Load settings_local.py if exists 142 | # ============================================================================= 143 | try: 144 | from .settings_local import * 145 | except ImportError: 146 | pass 147 | -------------------------------------------------------------------------------- /django18/project_name/settings_local.py.example: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | DATABASES = { 5 | 'default': { 6 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', 7 | 'NAME': 'yourproject', 8 | 'USER': 'youruser', 9 | 'PASSWORD': 'yourpassword', 10 | 'HOST': '', 11 | 'PORT': '', 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /django18/project_name/settings_production.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | from settings import * 4 | 5 | DEBUG = False 6 | 7 | EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' 8 | 9 | DATABASES = { 10 | 'default': { 11 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', 12 | 'NAME': '{{ project_name }}', 13 | 'USER': '{{ project_name }}', 14 | 'PASSWORD': '{{ project_name }}', 15 | 'HOST': '', 16 | 'PORT': '', 17 | } 18 | } 19 | 20 | STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.CachedStaticFilesStorage' 21 | -------------------------------------------------------------------------------- /django18/project_name/urls.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | from django.conf.urls import include, url 4 | from django.contrib import admin 5 | from django.conf import settings 6 | 7 | urlpatterns = [ 8 | # admin 9 | url(r'^admin/', include(admin.site.urls)), 10 | ] 11 | 12 | if settings.DEBUG: 13 | urlpatterns.append( 14 | url( 15 | r'^media/(?P.*)$', 16 | 'django.views.static.serve', 17 | { 18 | 'document_root': settings.MEDIA_ROOT, 19 | 'show_indexes': True 20 | } 21 | ), 22 | ) 23 | -------------------------------------------------------------------------------- /django18/project_name/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for {{ project_name }} project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /django18/requirements.txt: -------------------------------------------------------------------------------- 1 | Django<1.9 2 | Pillow>=2.9.0 3 | gunicorn>=19.3.0 4 | coverage>=3.7.1 5 | psycopg2>=2.5.2 6 | pytz>=2015.4 -------------------------------------------------------------------------------- /django18/runtests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | coverage run --source=apps manage.py test 3 | coverage report -m -------------------------------------------------------------------------------- /django18/static/README.md: -------------------------------------------------------------------------------- 1 | static 2 | ====== 3 | 4 | This directory is a container for all static files collected by collectstatic command. 5 | 6 | It's available via /static/ url when DEBUG=True. -------------------------------------------------------------------------------- /django18/templates/README.md: -------------------------------------------------------------------------------- 1 | templates 2 | ========= 3 | 4 | This is the directory for project template files. --------------------------------------------------------------------------------