· 4 years ago · Mar 02, 2021, 07:42 PM
1remote: Compressing source files... done.
2remote: Building source:
3remote:
4remote: -----> Building on the Heroku-20 stack
5remote: -----> Python app detected
6remote: -----> Installing python-3.8.8
7remote: -----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2
8remote: -----> Installing dependencies with Pipenv 2020.11.15
9remote: Installing dependencies from Pipfile.lock (4a3634)...
10remote: -----> Installing SQLite3
11remote: -----> $ python manage.py collectstatic --noinput
12remote: Traceback (most recent call last):
13remote: File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 224, in fetch_command
14remote: app_name = commands[subcommand]
15remote: KeyError: 'collectstatic'
16remote: During handling of the above exception, another exception occurred:
17remote: Traceback (most recent call last):
18remote: File "manage.py", line 23, in <module>
19remote: main()
20remote: File "manage.py", line 19, in main
21remote: execute_from_command_line(sys.argv)
22remote: File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
23remote: utility.execute()
24remote: File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
25remote: self.fetch_command(subcommand).run_from_argv(self.argv)
26remote: File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 231, in fetch_command
27remote: settings.INSTALLED_APPS
28remote: File "/app/.heroku/python/lib/python3.8/site-packages/django/conf/__init__.py", line 83, in __getattr__
29remote: self._setup(name)
30remote: File "/app/.heroku/python/lib/python3.8/site-packages/django/conf/__init__.py", line 70, in _setup
31remote: self._wrapped = Settings(settings_module)
32remote: File "/app/.heroku/python/lib/python3.8/site-packages/django/conf/__init__.py", line 196, in __init__
33remote: raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
34remote: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
35remote:
36remote: ! Error while running '$ python manage.py collectstatic --noinput'.
37remote: See traceback above for details.
38remote:
39remote: You may need to update application code to resolve this error.
40remote: Or, you can disable collectstatic for this application:
41remote:
42remote: $ heroku config:set DISABLE_COLLECTSTATIC=1
43remote:
44remote: https://devcenter.heroku.com/articles/django-assets
45remote: ! Push rejected, failed to compile Python app.
46remote:
47remote: ! Push failed
48remote: Verifying deploy...
49remote:
50remote: ! Push rejected
51
52DIRECTORY STRUCTURE
53├── entries
54├── .git
55│ ├── branches
56│ ├── hooks
57│ ├── info
58│ ├── logs
59│ │ └── refs
60│ │ ├── heads
61│ │ └── remotes
62│ │ └── origin
63│ ├── objects
64│ └── refs
65│ ├── heads
66│ ├── remotes
67│ │ └── origin
68│ └── tags
69├── parkx
70│ └── settings
71├── static
72│ └── wiki
73├── staticfiles
74│ ├── admin
75│ │ ├── css
76│ │ │ └── vendor
77│ │ │ └── select2
78│ │ ├── fonts
79│ │ ├── img
80│ │ │ └── gis
81│ │ └── js
82│ │ ├── admin
83│ │ └── vendor
84│ │ ├── jquery
85│ │ ├── select2
86│ │ │ └── i18n
87│ │ └── xregexp
88│ └── wiki
89└── wiki
90 ├── migrations
91 ├── static
92 │ └── wiki
93 └── templates
94 └── wiki
95
96SETTINGS.PY
97"""
98Django settings for parkx project.
99
100Generated by 'django-admin startproject' using Django 3.1.
101
102For more information on this file, see
103https://docs.djangoproject.com/en/3.1/topics/settings/
104
105For the full list of settings and their values, see
106https://docs.djangoproject.com/en/3.1/ref/settings/
107"""
108
109from pathlib import Path
110import os
111# import django_on_heroku
112
113# Build paths inside the project like this: BASE_DIR / 'subdir'.
114BASE_DIR = Path(__file__).resolve(strict=True).parent.parent.parent
115# heroku recommended base_dir?
116# BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
117
118
119# Quick-start development settings - unsuitable for production
120# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
121
122# SECURITY WARNING: keep the secret key used in production secret!
123# SECRET_KEY = os.getenv('SECRET_KEY')
124SECRET_KEY = os.environ['SECRET_KEY']
125
126# SECURITY WARNING: don't run with debug turned on in production!
127DEBUG = False
128# DEBUG = os.environ.get('DEBUG', False)
129# os.environ.get('COMPRESS_OFFLINE', True)
130
131# ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS')
132# ALLOWED_HOSTS = os.environ['ALLOWED_HOSTS']
133ALLOWED_HOSTS = ['*']
134
135
136# Application definition
137
138INSTALLED_APPS = [
139 'django.contrib.admin',
140 'django.contrib.auth',
141 'django.contrib.contenttypes',
142 'django.contrib.sessions',
143 'django.contrib.messages',
144 'django.contrib.staticfiles',
145 'wiki.apps.WikiConfig' #wiki app
146]
147
148MIDDLEWARE = [
149 'django.middleware.security.SecurityMiddleware',
150 # whitenoise
151 'whitenoise.middleware.WhiteNoiseMiddleware',
152 'django.contrib.sessions.middleware.SessionMiddleware',
153 'django.middleware.common.CommonMiddleware',
154 'django.middleware.csrf.CsrfViewMiddleware',
155 'django.contrib.auth.middleware.AuthenticationMiddleware',
156 'django.contrib.messages.middleware.MessageMiddleware',
157 'django.middleware.clickjacking.XFrameOptionsMiddleware',
158 # trying this for static files idk
159 # https://docs.djangoproject.com/en/3.1/ref/settings/#staticfiles-finders
160 # 'django.contrib.staticfiles.finders.FileSystemFinder',
161 # 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
162 'django.contrib.staticfiles'
163]
164
165ROOT_URLCONF = 'parkx.urls'
166
167TEMPLATES = [
168 {
169 'BACKEND': 'django.template.backends.django.DjangoTemplates',
170 'DIRS': [],
171 'APP_DIRS': True,
172 'OPTIONS': {
173 'context_processors': [
174 'django.template.context_processors.debug',
175 'django.template.context_processors.request',
176 'django.contrib.auth.context_processors.auth',
177 'django.contrib.messages.context_processors.messages',
178 ],
179 },
180 },
181]
182
183WSGI_APPLICATION = 'parkx.wsgi.application'
184
185
186# Database
187# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
188
189DATABASES = {
190 'default': {
191 'ENGINE': 'django.db.backends.sqlite3',
192 'NAME': BASE_DIR / 'db.sqlite3',
193 }
194}
195
196
197# Password validation
198# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
199
200AUTH_PASSWORD_VALIDATORS = [
201 {
202 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
203 },
204 {
205 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
206 },
207 {
208 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
209 },
210 {
211 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
212 },
213]
214
215
216# Internationalization
217# https://docs.djangoproject.com/en/3.1/topics/i18n/
218
219LANGUAGE_CODE = 'en-us'
220
221TIME_ZONE = 'UTC'
222
223USE_I18N = True
224
225USE_L10N = True
226
227USE_TZ = True
228
229
230# Static files (CSS, JavaScript, Images)
231# https://docs.djangoproject.com/en/3.1/howto/static-files/
232# https://docs.djangoproject.com/en/3.1/ref/contrib/staticfiles/
233
234STATIC_URL = '/static/'
235# STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
236STATIC_ROOT = BASE_DIR / 'staticfiles'
237STATICFILES_DIRS = [
238 BASE_DIR / 'static', # project level static files directory
239 ("wiki","/wiki/static/wiki") # https://docs.djangoproject.com/en/3.1/ref/settings/#staticfiles-dirs-prefixes
240 # os.path.join(BASE_DIR, 'static'),
241 # os.path.join(BASE_DIR, 'wiki','static'),
242 # os.path.join(BASE_DIR, 'wiki','static','wiki')
243]
244# STATICFILES_DIR = [os.path.join(BASE_DIR, 'staticfiles')]
245# django_on_heroku.settings(locals())
246
247# http://whitenoise.evans.io/en/stable/django.html
248STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' # compression with caching
249# STATICFILES_STORAGE = 'whitenoise.storage.CompressedStaticFilesStorage' # just compression