mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-29 04:54:02 +03:00
Setup fixes
This commit is contained in:
parent
eb35064b13
commit
d58da9e5e8
|
@ -6,6 +6,8 @@ django-braces==1.2.2
|
|||
django-model-utils==1.4.0
|
||||
django-floppyforms==1.1
|
||||
Pillow==2.1.0
|
||||
dj-database-url==0.2.2
|
||||
django-secure==1.0
|
||||
|
||||
# For user registration, either via email or social
|
||||
# Well-built with regular release cycles!
|
||||
|
|
|
@ -11,17 +11,20 @@ https://docs.djangoproject.com/en/dev/ref/settings/
|
|||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
import os
|
||||
from os.path import abspath, basename, dirname, join, normpath
|
||||
from os.path import join
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||
|
||||
########## DEBUG CONFIGURATION
|
||||
if os.environ.get("DATABASE_URL", None):
|
||||
########## DEBUG CONFIGURATION
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
|
||||
DEBUG = False
|
||||
else:
|
||||
DEBUG = True
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
########## END DEBUG CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
########## END DEBUG CONFIGURATION
|
||||
|
||||
|
||||
########## SECRET CONFIGURATION
|
||||
|
@ -54,7 +57,7 @@ MANAGERS = ADMINS
|
|||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
|
||||
import dj_database_url
|
||||
DATABASES = {'default': dj_database_url.config()}
|
||||
if DATABASES == {}:
|
||||
if DATABASES == {'default': {}}:
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
|
@ -100,7 +103,6 @@ MIDDLEWARE_CLASSES = (
|
|||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
#'djstripe.middleware.SubscriptionPaymentMiddleware', # TODO fix this by settings
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
)
|
||||
########## END MIDDLEWARE CONFIGURATION
|
||||
|
@ -141,11 +143,6 @@ TEMPLATE_CONTEXT_PROCESSORS = (
|
|||
'django.core.context_processors.request',
|
||||
)
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
)
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
|
||||
TEMPLATE_DIRS = (
|
||||
|
@ -201,10 +198,10 @@ INSTALLED_APPS += (
|
|||
|
||||
|
||||
########## URL Configuration
|
||||
ROOT_URLCONF = '{{cookiecutter.repo_nam}}.urls'
|
||||
ROOT_URLCONF = 'config.urls'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
|
||||
WSGI_APPLICATION = '{{cookiecutter.repo_nam}}.wsgi.application'
|
||||
WSGI_APPLICATION = 'config.wsgi.application'
|
||||
########## End URL Configuration
|
||||
|
||||
########## django-secure
|
||||
|
@ -308,7 +305,7 @@ else:
|
|||
|
||||
########## EMAIL
|
||||
DEFAULT_FROM_EMAIL = environ.get('DEFAULT_FROM_EMAIL',
|
||||
'{{cookiecutter.project_name}} <{{cookiecutter.project_name}}-noreply@{{cookiecutter.domain_name}}>')
|
||||
'{{cookiecutter.project_name}} <{{cookiecutter.project_name}}-noreply@{{cookiecutter.doman_name}}>')
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||
EMAIL_HOST = environ.get('EMAIL_HOST', 'smtp.sendgrid.com')
|
||||
EMAIL_HOST_PASSWORD = os.environ.get('SENDGRID_PASSWORD', '')
|
||||
|
|
|
@ -21,7 +21,7 @@ SITE_ROOT = dirname(dirname(abspath(__file__)))
|
|||
path.append(SITE_ROOT)
|
||||
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ cookiecutter.repo_name }}.settings")
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
|
||||
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
|
|
@ -3,7 +3,7 @@ import os
|
|||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.config.local")
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
|
||||
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Import the reverse lookup function
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db.models import Count, Sum
|
||||
|
||||
# view imports
|
||||
from django.views.generic import DetailView
|
||||
|
@ -15,8 +14,6 @@ from braces.views import LoginRequiredMixin
|
|||
# Import the form from users/forms.py
|
||||
from .forms import UserForm
|
||||
|
||||
from djstripe.mixins import SubscriptionPaymentRequiredMixin
|
||||
|
||||
# Import the customized User model
|
||||
from .models import User
|
||||
|
||||
|
@ -53,7 +50,7 @@ class UserUpdateView(LoginRequiredMixin, UpdateView):
|
|||
return User.objects.get(username=self.request.user.username)
|
||||
|
||||
|
||||
class UserListView(LoginRequiredMixin, SubscriptionPaymentRequiredMixin, ListView):
|
||||
class UserListView(LoginRequiredMixin, ListView):
|
||||
model = User
|
||||
# These next two lines tell the view to index lookups by username
|
||||
slug_field = "username"
|
||||
|
|
Loading…
Reference in New Issue
Block a user