Cookiecutter-django: ModuleNotFoundError

Created on 6 Feb 2018  路  11Comments  路  Source: pydanny/cookiecutter-django

ModuleNotFoundError: No module named "'config" on heroku

Most helpful comment

@joseGabriel06 please, provide a full traceback log.

heroku logs

Having said that, many years ago, when I was beginning in the development world, someone recommended me to read this text: http://www.catb.org/esr/faqs/smart-questions.html

All 11 comments

Could you please follow the issue template to provide us with more information? It would be helpful to give more information about your environment as well as the full stack trace.

@joseGabriel06 please, provide a full traceback log.

heroku logs

Having said that, many years ago, when I was beginning in the development world, someone recommended me to read this text: http://www.catb.org/esr/faqs/smart-questions.html

-----> Installing requirements with pip
-----> $ python manage.py collectstatic --noinput
Traceback (most recent call last):
File "manage.py", line 30, in
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 308, in execute
settings.INSTALLED_APPS
File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
self._setup(name)
File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 110, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 978, in _gcd_import
File "", line 961, in _find_and_load
File "", line 936, in _find_and_load_unlocked
File "", line 205, in _call_with_frames_removed
File "", line 978, in _gcd_import
File "", line 961, in _find_and_load
File "", line 936, in _find_and_load_unlocked
File "", line 205, in _call_with_frames_removed
File "", line 978, in _gcd_import
File "", line 961, in _find_and_load
File "", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named "'config"
! Error while running '$ python manage.py collectstatic --noinput'.
See traceback above for details.
You may need to update application code to resolve this error.
Or, you can disable collectstatic for this application:
$ heroku config:set DISABLE_COLLECTSTATIC=1
https://devcenter.heroku.com/articles/django-assets
! Push rejected, failed to compile Python app.
! Push failed

@joseGabriel06 have you made any changes to the project since its creation?

@webyneter do not

I guess, it might have something to do with #1467. @ddiazpinto what do you think?

I'm going to check

what is the output of

heroku run ls -la

@luzfcb
total 104
drwx------ 9 u38534 dyno 4096 Feb 6 19:41 .
drwxr-xr-x 15 root root 4096 Jan 23 18:33 ..
drwx------ 3 u38534 dyno 4096 Feb 6 16:41 config
-rw------- 1 u38534 dyno 26 Feb 6 16:41 CONTRIBUTORS.txt
-rw------- 1 u38534 dyno 98 Feb 6 16:41 .coveragerc
drwx------ 2 u38534 dyno 4096 Feb 6 16:41 docs
-rw------- 1 u38534 dyno 485 Feb 6 16:41 .editorconfig
-rw------- 1 u38534 dyno 746 Feb 6 16:41 env.example
-rw------- 1 u38534 dyno 12 Feb 6 16:41 .gitattributes
-rw------- 1 u38534 dyno 4389 Feb 6 16:41 .gitignore
drwx------ 4 u38534 dyno 4096 Feb 6 16:41 .heroku
-rw------- 1 u38534 dyno 1 Feb 6 16:41 LICENSE
-rw------- 1 u38534 dyno 1041 Feb 6 16:41 manage.py
-rw------- 1 u38534 dyno 39 Feb 6 16:41 Procfile
drwx------ 2 u38534 dyno 4096 Feb 6 16:41 .profile.d
-rw------- 1 u38534 dyno 257 Feb 6 16:41 .pylintrc
-rw------- 1 u38534 dyno 54 Feb 6 16:41 pytest.ini
-rw------- 1 u38534 dyno 2206 Feb 6 16:41 README.rst
drwx------ 2 u38534 dyno 4096 Feb 6 16:41 requirements
-rw------- 1 u38534 dyno 151 Feb 6 16:41 requirements.txt
-rw------- 1 u38534 dyno 12 Feb 6 16:41 runtime.txt
-rw------- 1 u38534 dyno 206 Feb 6 16:41 setup.cfg
-rw------- 1 u38534 dyno 579 Feb 6 16:41 .travis.yml
drwx------ 2 u38534 dyno 4096 Feb 6 16:41 utility

Works fine on my end, I've run the following bash script:

#!/bin/bash

cookiecutter https://github.com/pydanny/cookiecutter-django --no-input --overwrite-if-exists \
use_heroku=y \
js_task_runner=None \
use_sentry_for_error_reporting=n \
use_pycharm=n \
project_name='Heroku Tests'

cd heroku_tests

git init
git add . 
git commit -m "Initial commit"

heroku create

heroku config:set \
DJANGO_ADMIN_URL='^staff/' \
DJANGO_SETTINGS_MODULE=config.settings.production \
DJANGO_SECRET_KEY='ebeez6qua3uzaeSoogoo1shah7mang6eesh1bees' \
DJANGO_ALLOWED_HOSTS='*' \
DJANGO_AWS_ACCESS_KEY_ID='fake' \
DJANGO_AWS_SECRET_ACCESS_KEY='secret' \
DJANGO_AWS_STORAGE_BUCKET_NAME='my-stuff' \
DJANGO_MAILGUN_API_KEY='svjsaj' \
DJANGO_SERVER_EMAIL='[email protected]' \
MAILGUN_SENDER_DOMAIN='example.com'

heroku addons:create heroku-postgresql:hobby-dev

git push --set-upstream heroku master

heroku run python manage.py migrate

heroku open

And here is the resulting app:
https://murmuring-fjord-52109.herokuapp.com/

What are the answers you gave to the cookiecutter questions?

@joseGabriel06, closing this as "works for us". Please start over from scratch, and record what you put in for Cookiecutter values. If you run into the same problem, follow the issue template and post as @browniebloke just did.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

linuxluigi picture linuxluigi  路  3Comments

saschalalala picture saschalalala  路  4Comments

yunti picture yunti  路  4Comments

huydbui picture huydbui  路  3Comments

webyneter picture webyneter  路  3Comments