· 10 years ago · Apr 09, 2016, 11:42 AM
1from django.db import models
2from django.contrib.auth.models import User
3from django.utils.translation import ugettext as _
4from userena.models import UserenaBaseProfile
5
6class MyProfile(UserenaBaseProfile):
7user = models.OneToOneField(User,
8 unique=True,
9 verbose_name=_('user'),
10 related_name='my_profile')
11favourite_snack = models.CharField(_('favourite snack'),
12 max_length=5)
13
14# Django settings for photostock project.
15
16DEBUG = True
17TEMPLATE_DEBUG = DEBUG
18
19ADMINS = (
20# ('Your Name', 'your_email@example.com'),
21 )
22
23MANAGERS = ADMINS
24EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
25EMAIL_USE_TLS = True
26EMAIL_HOST = 'smtp.gmail.com'
27EMAIL_PORT = 587
28EMAIL_HOST_USER = 'software1@finder-lbs.com'
29EMAIL_HOST_PASSWORD = 'f1d3r!@#'
30
31DATABASES = {
32'default': {
33 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
34 'NAME': 'photo', # Or path to database file if using sqlite3.
35 # The following settings are not used with sqlite3:
36 'USER': '',
37 'PASSWORD': '',
38 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
39 'PORT': '', # Set to empty string for default.
40}
41}
42 AUTHENTICATION_BACKENDS = (
43 'userena.backends.UserenaAuthenticationBackend',
44 'guardian.backends.ObjectPermissionBackend',
45 'django.contrib.auth.backends.ModelBackend',
46 )
47 #AUTH_USER_MODEL = "login.PropaUser"
48
49 # Hosts/domain names that are valid for this site; required if DEBUG is False
50 # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
51 ALLOWED_HOSTS = []
52
53 # Local time zone for this installation. Choices can be found here:
54 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
55 # although not all choices may be available on all operating systems.
56 # In a Windows environment this must be set to your system time zone.
57 TIME_ZONE = 'America/Chicago'
58
59 # Language code for this installation. All choices can be found here:
60 # http://www.i18nguy.com/unicode/language-identifiers.html
61 LANGUAGE_CODE = 'en-us'
62
63 SITE_ID = 1
64
65 # If you set this to False, Django will make some optimizations so as not
66 # to load the internationalization machinery.
67 USE_I18N = True
68
69 # If you set this to False, Django will not format dates, numbers and
70 # calendars according to the current locale.
71 USE_L10N = True
72
73 # If you set this to False, Django will not use timezone-aware datetimes.
74 USE_TZ = True
75
76 # Absolute filesystem path to the directory that will hold user-uploaded files.
77 # Example: "/var/www/example.com/media/"
78 MEDIA_ROOT = ''
79
80 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
81 # trailing slash.
82 # Examples: "http://example.com/media/", "http://media.example.com/"
83 MEDIA_URL = ''
84
85 # Absolute path to the directory static files should be collected to.
86 # Don't put anything in this directory yourself; store your static files
87 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
88 # Example: "/var/www/example.com/static/"
89 STATIC_ROOT = ''
90
91 # URL prefix for static files.
92 # Example: "http://example.com/static/", "http://static.example.com/"
93 STATIC_URL = '/static/'
94
95 # Additional locations of static files
96 STATICFILES_DIRS = (
97 # Put strings here, like "/home/html/static" or "C:/www/django/static".
98 # Always use forward slashes, even on Windows.
99 # Don't forget to use absolute paths, not relative paths.
100 )
101
102 # List of finder classes that know how to find static files in
103 # various locations.
104 STATICFILES_FINDERS = (
105 'django.contrib.staticfiles.finders.FileSystemFinder',
106 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
107 # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
108 )
109
110 # Make this unique, and don't share it with anybody.
111 SECRET_KEY = 'tr!)ra#+%miw(qo^ot)v8@i+$2+4o9io=7p6w3hd=i$3m2!tkr'
112
113 # List of callables that know how to import templates from various sources.
114 TEMPLATE_LOADERS = (
115 'django.template.loaders.filesystem.Loader',
116 'django.template.loaders.app_directories.Loader',
117 # 'django.template.loaders.eggs.Loader',
118 )
119
120 MIDDLEWARE_CLASSES = (
121 'django.middleware.common.CommonMiddleware',
122 'django.contrib.sessions.middleware.SessionMiddleware',
123 'django.middleware.csrf.CsrfViewMiddleware',
124 'django.contrib.auth.middleware.AuthenticationMiddleware',
125 'django.contrib.messages.middleware.MessageMiddleware',
126 # Uncomment the next line for simple clickjacking protection:
127 # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
128 )
129
130 ROOT_URLCONF = 'photostock.urls'
131
132 # Python dotted path to the WSGI application used by Django's runserver.
133 WSGI_APPLICATION = 'photostock.wsgi.application'
134
135 TEMPLATE_DIRS = (
136 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
137 # Always use forward slashes, even on Windows.
138 # Don't forget to use absolute paths, not relative paths.
139 )
140
141 INSTALLED_APPS = (
142 'django.contrib.auth',
143 'django.contrib.contenttypes',
144 'django.contrib.sessions',
145 'django.contrib.sites',
146 'django.contrib.messages',
147 'django.contrib.staticfiles',
148 # Uncomment the next line to enable the admin:
149 # 'django.contrib.admin',
150 # Uncomment the next line to enable admin documentation:
151 # 'django.contrib.admindocs',
152 'userena',
153 'guardian',
154 'easy_thumbnails',
155 'accounts',
156 )
157 ANONYMOUS_USER_ID = -1
158 AUTH_PROFILE_MODULE = 'accounts.MyProfile'
159
160 LOGIN_REDIRECT_URL = '/accounts/%(username)s/'
161 LOGIN_URL = '/accounts/signin/'
162 LOGOUT_URL = '/accounts/signout/'
163
164 SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
165
166 # A sample logging configuration. The only tangible logging
167 # performed by this configuration is to send an email to
168 # the site admins on every HTTP 500 error when DEBUG=False.
169 # See http://docs.djangoproject.com/en/dev/topics/logging for
170 # more details on how to customize your logging configuration.
171 LOGGING = {
172 'version': 1,
173 'disable_existing_loggers': False,
174 'filters': {
175 'require_debug_false': {
176 '()': 'django.utils.log.RequireDebugFalse'
177 }
178 },
179 'handlers': {
180 'mail_admins': {
181 'level': 'ERROR',
182 'filters': ['require_debug_false'],
183 'class': 'django.utils.log.AdminEmailHandler'
184 }
185 },
186 'loggers': {
187 'django.request': {
188 'handlers': ['mail_admins'],
189 'level': 'ERROR',
190 'propagate': True,
191 },
192 }
193}
194
195DatabaseError at /accounts/signin/
196
197 no such table: auth_user
198
199 Request Method: POST
200 Request URL: http://localhost:8000/accounts/signin/
201 Django Version: 1.5.5
202 Exception Type: DatabaseError
203 Exception Value: no such table: auth_user
204
205AUTH_PROFILE_MODULE = 'accounts.MyProfile'