Permalink
Browse files

Cleanups and updates to support django 1.7.

  • Loading branch information...
1 parent a6a2d93 commit aeff46f11dea840572c27675316678cf1836d0fb @xenith committed Nov 6, 2013
View
@@ -1,17 +1,18 @@
{% if False %}
-# Django 1.5 Base Template #
+# Django 1.6 Base Template #
## About ##
This template is based off of the work of [Mozilla Playdoh][playdoh] and
[Two Scoops of Django][twoscoops], as well as experience with other Django
-layouts/project templates. Playdoh is mainly setup for Mozilla's systems, and is
-currently only designed for Django 1.4.
+layouts/project templates. Playdoh is mainly setup for Mozilla's systems and is
+overly-complicated for a simple project template. (Though it does provide some
+very good real-world use examples.)
-This project template is designed for Django 1.4's new startproject template option. This version of the project template is designed for Django 1.5.
+This project template is designed for Django 1.4's new startproject template option. This version of the project template is designed for Django 1.6.
As much as I could, all the code has been updated to use the new suggested layout
-and functionality in Django 1.5.
+and functionality in Django 1.6.
[playdoh]: https://github.com/mozilla/playdoh
[twoscoops]: https://github.com/twoscoops/django-twoscoops-project
@@ -25,13 +26,12 @@ base app)
Templating:
-- Markdown
- django_compressor for compressing javascript/css/less/sass
Security:
- bleach
-- python-bcrypt2 - uses bcrypt for password hashing by default
+- bcrypt - uses bcrypt for password hashing by default
Background Tasks:
@@ -48,7 +48,6 @@ Caching:
Admin:
- Includes django-admin-toolbar for development and production (enabled for superusers)
-- Includes django-debug-toolbar-user-panel, which is quite useful, but is disabled until it fully supports Django 1.5
Testing:
@@ -60,7 +59,7 @@ Any of these options can added, modified, or removed as you like after creating
## How to use this project template to create your project ##
- Create your working environment and virtualenv
-- Install Django 1.5 ($ pip install Django>=1.5)
+- Install Django 1.6 ($ pip install Django>=1.6)
- $ django-admin.py startproject --template https://github.com/xenith/django-base-template/zipball/master --extension py,md,rst projectname
- $ cd projectname
- Uncomment your preferred database adapter in requirements/compiled.txt (MySQL, Postgresql, or skip this step to stick with SQLite)
@@ -72,10 +71,16 @@ Any of these options can added, modified, or removed as you like after creating
That's all you need to do to get the project ready for development. When you deploy your project into production, you should look into getting certain settings from environment variables or other external sources. (See SECRET_KEY for an example.)
-There isn't a need to add settings/local.py to your source control, but there are multiple schools of thought on this. The method I use here is an example where each developer has their own settings/local.py with machine-specific settings. You will also need to create a version of settings/local.py for use in deployment that you will put into place with your deployment system (Fabric, chef, puppet, etc).
+There isn't a need to add settings/local.py to your source control, but there are multiple schools of thought on this. The method I use here is an example where each developer has their own settings/local.py with machine-specific settings. You will also need to create a version of settings/local.py for use in production that you will put into place with your deployment system (Fabric, chef, puppet, etc).
The second school of thought is that all settings should be versioned, so that as much of the code/settings as possible is the same across all developers and test/production servers. If you prefer this method, then make sure *all* necessary settings are properly set in settings/base.py, and then edit settings/__init__.py so it no longer reraises the exception. (ie, by replacing 'raise' with 'pass'). As it is, settings/local.py should only be overriding settings from settings/base.py anyway. (You could also just set the DJANGO_SETTINGS_MODULE environment variable to "{{ project_name }}.settings.base" directly.)
+## Special note ##
+
+In the next version of this template (for Django 1.7), South will likely be removed. Django 1.7 is expected to ship with a native migration system which is heavily based up and written by the author of South. For more information, see [the Django 1.7 development documentation][docs].
+
+[docs]: https://docs.djangoproject.com/en/dev/topics/migrations/
+
{% endif %}
# The {{ project_name|title }} Project #
@@ -29,8 +29,6 @@ def get_env_setting(setting):
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
-SITE_ID = 1
-
# Defines the views served for root URLs.
ROOT_URLCONF = '{{ project_name }}.urls'
@@ -40,11 +38,8 @@ def get_env_setting(setting):
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
- 'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
- 'django.contrib.admindocs',
- 'django.contrib.markup',
'django.contrib.humanize',
'django.contrib.syndication',
'django.contrib.staticfiles',
@@ -53,7 +48,6 @@ def get_env_setting(setting):
'djcelery',
'debug_toolbar',
'compressor',
- #'debug_toolbar_user_panel',
# Database migrations
'south',
@@ -67,6 +61,7 @@ def get_env_setting(setting):
# Place bcrypt first in the list, so it will be the default password hashing
# mechanism
PASSWORD_HASHERS = (
+ 'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
'django.contrib.auth.hashers.BCryptPasswordHasher',
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
@@ -270,9 +265,8 @@ def custom_show_toolbar(request):
INTERNAL_IPS = ('127.0.0.1')
-# Enable these options for memcached
+# Enable this option for memcached
#CACHE_BACKEND= "memcached://127.0.0.1:11211/"
-#CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True
# Set this to true if you use a proxy that sets X-Forwarded-Host
#USE_X_FORWARDED_HOST = False
@@ -6,7 +6,9 @@
from . import base
-# To extend any settings from settings/base.py here's an example:
+# To extend any settings from settings/base.py here's an example.
+# If you don't need to extend any settings from base.py, you do not need
+# to import base above
INSTALLED_APPS = base.INSTALLED_APPS + ('django_nose',)
DATABASES = {
@@ -7,11 +7,6 @@
from .base import *
-TEST_RUNNER = 'discover_runner.DiscoverRunner'
-TEST_DISCOVER_TOP_LEVEL = PROJECT_ROOT
-TEST_DISCOVER_ROOT = PROJECT_ROOT
-TEST_DISCOVER_PATTERN = "test_*.py"
-
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
@@ -12,10 +12,10 @@ def bad(request):
1 / 0
urlpatterns = patterns('',
- url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
- url(r'^admin/$', admin.site.admin_view(admin.site.index)),
+ # Examples:
+ # url(r'^$', '{{ project_name }}.views.home', name='home'),
+ # url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
- #url(r'^', include('debug_toolbar_user_panel.urls')),
url(r'^bad/$', bad),
url(r'', include('base.urls')),
)
@@ -3,4 +3,4 @@
#MySQL-python
# for bcrypt passwords
-py-bcrypt
+bcrypt
@@ -1,5 +1,5 @@
# This file pulls in everything a developer needs. If it's a basic package
-# needed to run the site, it belongs in requirements/prod.txt. If it's a
+# needed to run the site, it belongs in requirements/production.txt. If it's a
# package for developers (testing, docs, etc.), it goes in this file.
-r production.txt
@@ -16,5 +16,3 @@ django-nose
coverage
pep8
pylint
-django-discover-runner
-
@@ -2,10 +2,9 @@
-r compiled.txt
# Django stuff
-Django>=1.5
+Django>=1.6
# Templates
-Markdown
django_compressor
# Security
@@ -28,12 +27,9 @@ python-memcached
# Admin
django-debug-toolbar
-# There are useful panels for debug-toolbar, but have not quite been updated yet for 1.5
-#-e git://github.com/playfire/django-debug-toolbar-user-panel#egg=django_debug_toolbar_user_panel-dev
# Migrations
South
# Feature testing
#django-waffle
-

0 comments on commit aeff46f

Please sign in to comment.