Report this

What is the reason for this report?

ModuleNotFoundError: No module named 'dj_database_url'

Posted on January 28, 2022

Connected Tutorial(This question is a follow-up to this tutorial):

How To Deploy a Django App on App Platform

I am having an issue, I followed the tutorial but continue to get a module not found error. I have tried everything, there is a requirements.txt file.

[2022-01-28 01:31:43] => Initializing build [2022-01-28 01:31:43] => Retrieving source code to /workspace [2022-01-28 01:31:43] => Selecting branch “master” [2022-01-28 01:31:44] => Checking out commit “10f0cda9447e51180740a5a38d1fd5dc2012932d” [2022-01-28 01:31:44] => Got source_dir: / [2022-01-28 01:31:44] => Using workspace root /workspace [2022-01-28 01:31:45] [2022-01-28 01:31:45] => Building app using buildpacks [2022-01-28 01:31:45] => Injecting app environment variables: [2022-01-28 01:31:45] DEBUG DJANGO_ALLOWED_HOSTS DJANGO_SECRET_KEY [2022-01-28 01:31:45] => Running buildpack detection [2022-01-28 01:31:45] [2022-01-28 01:31:45] 3 of 4 buildpacks participating [2022-01-28 01:31:45] digitalocean/python-appdetect 0.0.2 [2022-01-28 01:31:45] heroku/python 0.205.4 [2022-01-28 01:31:45] digitalocean/procfile 0.0.3 [2022-01-28 01:31:45] [2022-01-28 01:31:45] For documentation on the buildpacks used to build your app, please see: [2022-01-28 01:31:45] Python: https://do.co/apps-buildpack-python [2022-01-28 01:31:46] [2022-01-28 01:31:46] => Building app [2022-01-28 01:31:46] [2022-01-28 01:31:46] -----> Using Python version specified in Pipfile.lock [2022-01-28 01:31:47] -----> Installing python-3.10.1 [2022-01-28 01:32:03] -----> Installing pip 21.3.1, setuptools 57.5.0 and wheel 0.37.0 [2022-01-28 01:32:25] -----> Installing dependencies with Pipenv 2020.11.15 [2022-01-28 01:32:26] Installing dependencies from Pipfile.lock (6dfa32)… [2022-01-28 01:32:39] -----> Installing SQLite3 [2022-01-28 01:32:57] -----> $ python manage.py collectstatic --noinput [2022-01-28 01:32:58] Traceback (most recent call last): [2022-01-28 01:32:58] File “/app/.heroku/python/lib/python3.10/site-packages/django/core/management/init.py”, line 243, in fetch_command [2022-01-28 01:32:58] app_name = commands[subcommand] [2022-01-28 01:32:58] KeyError: ‘collectstatic’ [2022-01-28 01:32:58] During handling of the above exception, another exception occurred: [2022-01-28 01:32:58] Traceback (most recent call last): [2022-01-28 01:32:58] File “/workspace/manage.py”, line 22, in <module> [2022-01-28 01:32:58] main() [2022-01-28 01:32:58] File “/workspace/manage.py”, line 18, in main [2022-01-28 01:32:58] execute_from_command_line(sys.argv) [2022-01-28 01:32:58] File “/app/.heroku/python/lib/python3.10/site-packages/django/core/management/init.py”, line 425, in execute_from_command_line [2022-01-28 01:32:58] utility.execute() [2022-01-28 01:32:58] File “/app/.heroku/python/lib/python3.10/site-packages/django/core/management/init.py”, line 419, in execute [2022-01-28 01:32:58] self.fetch_command(subcommand).run_from_argv(self.argv) [2022-01-28 01:32:58] File “/app/.heroku/python/lib/python3.10/site-packages/django/core/management/init.py”, line 250, in fetch_command [2022-01-28 01:32:58] settings.INSTALLED_APPS [2022-01-28 01:32:58] File “/app/.heroku/python/lib/python3.10/site-packages/django/conf/init.py”, line 84, in getattr [2022-01-28 01:32:58] self._setup(name) [2022-01-28 01:32:58] File “/app/.heroku/python/lib/python3.10/site-packages/django/conf/init.py”, line 71, in _setup [2022-01-28 01:32:58] self._wrapped = Settings(settings_module) [2022-01-28 01:32:58] File “/app/.heroku/python/lib/python3.10/site-packages/django/conf/init.py”, line 179, in init [2022-01-28 01:32:58] mod = importlib.import_module(self.SETTINGS_MODULE) [2022-01-28 01:32:58] File “/app/.heroku/python/lib/python3.10/importlib/init.py”, line 126, in import_module [2022-01-28 01:32:58] return _bootstrap._gcd_import(name[level:], package, level) [2022-01-28 01:32:58] File “<frozen importlib._bootstrap>”, line 1050, in _gcd_import [2022-01-28 01:32:58] File “<frozen importlib._bootstrap>”, line 1027, in _find_and_load [2022-01-28 01:32:58] File “<frozen importlib._bootstrap>”, line 1006, in _find_and_load_unlocked [2022-01-28 01:32:58] File “<frozen importlib._bootstrap>”, line 688, in _load_unlocked [2022-01-28 01:32:58] File “<frozen importlib._bootstrap_external>”, line 883, in exec_module [2022-01-28 01:32:58] File “<frozen importlib._bootstrap>”, line 241, in _call_with_frames_removed [2022-01-28 01:32:58] File “/workspace/inventorious/settings/prod.py”, line 4, in <module> [2022-01-28 01:32:58] import dj_database_url [2022-01-28 01:32:58] ModuleNotFoundError: No module named ‘dj_database_url’ [2022-01-28 01:32:58] [2022-01-28 01:32:58] ! Error while running ‘$ python manage.py collectstatic --noinput’. [2022-01-28 01:32:58] See traceback above for details. [2022-01-28 01:32:58] [2022-01-28 01:32:58] You may need to update application code to resolve this error. [2022-01-28 01:32:58] Or, you can disable collectstatic for this application: [2022-01-28 01:32:58] [2022-01-28 01:32:58] $ heroku config:set DISABLE_COLLECTSTATIC=1 [2022-01-28 01:32:58] [2022-01-28 01:32:58] https://devcenter.heroku.com/articles/django-assets [2022-01-28 01:32:58] ERROR: failed to build: exit status 1 [2022-01-28 01:33:01] [2022-01-28 01:33:01] For documentation on the buildpacks used to build your app, please see: [2022-01-28 01:33:01] Python: https://do.co/apps-buildpack-python [2022-01-28 01:33:01] [2022-01-28 01:33:01] ! Build failed (145)

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.