· 7 years ago · Dec 18, 2018, 04:26 PM
1remote: File "/app/.heroku/python/lib/python3.7/site-packages/django/contrib/staticfiles/storage.py", line 43, in path
2remote: raise ImproperlyConfigured("You're using the staticfiles app "
3remote: django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
4remote:
5remote: ! Error while running '$ python manage.py collectstatic --noinput'.
6remote: See traceback above for details.
7remote:
8remote: You may need to update application code to resolve this error.
9remote: Or, you can disable collectstatic for this application:
10remote:
11remote: $ heroku config:set DISABLE_COLLECTSTATIC=1
12remote:
13remote: https://devcenter.heroku.com/articles/django-assets
14remote: ! Push rejected, failed to compile Python app.
15remote:
16remote: ! Push failed
17remote: Verifying deploy...
18remote:
19remote: ! Push rejected to murmuring-shelf-23422.
20 remote:
21
22"""
23 Django settings for Diary project.
24
25 Generated by 'django-admin startproject' using Django 2.1.3.
26
27 For more information on this file, see
28 https://docs.djangoproject.com/en/2.1/topics/settings/
29
30 For the full list of settings and their values, see
31 https://docs.djangoproject.com/en/2.1/ref/settings/
32 """
33
34 import os
35
36 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
37 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
38
39 import os
40
41 SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY','qtw*=jdvr++ekim7j*(yn9c33)krewr!fndfsw+(fsdftr-jsewre' )
42
43
44 # Quick-start development settings - unsuitable for production
45 # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
46
47 # SECURITY WARNING: keep the secret key used in production secret!
48
49
50 # SECURITY WARNING: don't run with debug turned on in production!
51 #DEBUG = False
52
53 DEBUG = bool(os.environ.get('DJANGO_DEBUG', True))
54
55 ALLOWED_HOSTS = ['.herokuapp.com','192.168.43.187','192.168.43.86',
56 '127.0.0.1',' 2001:0:9d38:90d7:1884:3321:3f57:fef6',
57 '192.168.1.7',]
58
59
60 # Application definition
61
62 INSTALLED_APPS = [
63'django.contrib.admin',
64'django.contrib.auth',
65'django.contrib.contenttypes',
66'django.contrib.sessions',
67'django.contrib.messages',
68'django.contrib.staticfiles',
69'django_user_agents',
70'CreateDiary',]
71
72 MIDDLEWARE = [
73'django.middleware.security.SecurityMiddleware',
74'whitenoise.middleware.WhiteNoiseMiddleware',
75 'django.contrib.sessions.middleware.SessionMiddleware',
76 'django.middleware.common.CommonMiddleware',
77 'django.middleware.csrf.CsrfViewMiddleware',
78 'django.contrib.auth.middleware.AuthenticationMiddleware',
79 'django.contrib.messages.middleware.MessageMiddleware',
80 'django.middleware.clickjacking.XFrameOptionsMiddleware',
81'django_user_agents.middleware.UserAgentMiddleware',
82
83ROOT_URLCONF = 'Diary.urls'
84
85TEMPLATES = [
86{
87 'BACKEND': 'django.template.backends.django.DjangoTemplates',
88 'DIRS': [],
89 'APP_DIRS': True,
90 'OPTIONS': {
91 'context_processors': [
92 'django.template.context_processors.debug',
93 'django.template.context_processors.request',
94 'django.contrib.auth.context_processors.auth',
95 'django.contrib.messages.context_processors.messages',
96 ],
97 },
98},
99
100WSGI_APPLICATION = 'Diary.wsgi.application'
101
102
103 # Database
104 # https://docs.djangoproject.com/en/2.1/ref/settings /#databases
105
106DATABASES = {
107'default': {
108 'ENGINE': 'django.db.backends.sqlite3',
109 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
110}
111
112# Password validation
113# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
114
115AUTH_PASSWORD_VALIDATORS = [
116{
117 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
118},
119{
120 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
121},
122{
123 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
124},
125{
126 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
127},
128
129# Internationalization
130# https://docs.djangoproject.com/en/2.1/topics/i18n/
131
132LANGUAGE_CODE = 'en-us'
133
134TIME_ZONE = 'UTC'
135
136USE_I18N = True
137
138USE_L10N = True
139
140USE_TZ = True
141
142STATIC_URL = '/static/'
143MEDIA_ROOT=os.path.join(BASE_DIR , 'media')
144MEDIA_URL='/media/'
145
146# Heroku: Update database configuration from $DATABASE_URL.
147import dj_database_url
148 db_from_env = dj_database_url.config(conn_max_age=500)
149DATABASES['default'].update(db_from_env)
150
151
152# Simplified static file serving.
153# https://warehouse.python.org/project/whitenoise/
154STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
155
156 # Static files (CSS, JavaScript, Images)
157 # https://docs.djangoproject.com/en/2.1/howto/static-files/
158
159 # The absolute path to the directory where collectstatic will collect static files for deployment.
160 STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
161
162 # The URL to use when referring to static files (where they will be served from)
163 STATIC_URL = '/static/'