Django manage.py runserver command does not work - python

So I downloaded python (latest version) with everything checked and added it to PATH.I installed django, created everything I need, got the django files, but when i run python manage.py runserver it ptinys a lot of stuff, but in the end it prints
I don't know anything about django or pip or python shell, I was following a tutorial but this doesnt work for me.
C:\djangoproject>python manage.py runserver
Traceback (most recent call last):
File "C:\Program Files (x86)\Python\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Program Files (x86)\Python\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Program Files (x86)\Python\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "C:\Program Files (x86)\Python\lib\site-packages\django\core\management\commands\runserver.py", line 67, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "C:\Program Files (x86)\Python\lib\site-packages\django\conf\__init__.py", line 79, in __getattr__
self._setup(name)
File "C:\Program Files (x86)\Python\lib\site-packages\django\conf\__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "C:\Program Files (x86)\Python\lib\site-packages\django\conf\__init__.py", line 157, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Program Files (x86)\Python\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'djangoproject'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "C:\Program Files (x86)\Python\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Program Files (x86)\Python\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Program Files (x86)\Python\lib\site-packages\django\core\management\base.py", line 336, in run_from_argv
connections.close_all()
File "C:\Program Files (x86)\Python\lib\site-packages\django\db\utils.py", line 219, in close_all
for alias in self:
File "C:\Program Files (x86)\Python\lib\site-packages\django\db\utils.py", line 213, in __iter__
return iter(self.databases)
File "C:\Program Files (x86)\Python\lib\site-packages\django\utils\functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Program Files (x86)\Python\lib\site-packages\django\db\utils.py", line 147, in databases
self._databases = settings.DATABASES
File "C:\Program Files (x86)\Python\lib\site-packages\django\conf\__init__.py", line 79, in __getattr__
self._setup(name)
File "C:\Program Files (x86)\Python\lib\site-packages\django\conf\__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "C:\Program Files (x86)\Python\lib\site-packages\django\conf\__init__.py", line 157, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Program Files (x86)\Python\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'djangoproject'
C:\djangoproject>python manage.py runserver
Traceback (most recent call last):
File "C:\Program Files (x86)\Python\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Program Files (x86)\Python\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Program Files (x86)\Python\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "C:\Program Files (x86)\Python\lib\site-packages\django\core\management\commands\runserver.py", line 67, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "C:\Program Files (x86)\Python\lib\site-packages\django\conf\__init__.py", line 79, in __getattr__
self._setup(name)
File "C:\Program Files (x86)\Python\lib\site-packages\django\conf\__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "C:\Program Files (x86)\Python\lib\site-packages\django\conf\__init__.py", line 157, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Program Files (x86)\Python\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'djangoproject'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "C:\Program Files (x86)\Python\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Program Files (x86)\Python\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Program Files (x86)\Python\lib\site-packages\django\core\management\base.py", line 336, in run_from_argv
connections.close_all()
File "C:\Program Files (x86)\Python\lib\site-packages\django\db\utils.py", line 219, in close_all
for alias in self:
File "C:\Program Files (x86)\Python\lib\site-packages\django\db\utils.py", line 213, in __iter__
return iter(self.databases)
File "C:\Program Files (x86)\Python\lib\site-packages\django\utils\functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Program Files (x86)\Python\lib\site-packages\django\db\utils.py", line 147, in databases
self._databases = settings.DATABASES
File "C:\Program Files (x86)\Python\lib\site-packages\django\conf\__init__.py", line 79, in __getattr__
self._setup(name)
File "C:\Program Files (x86)\Python\lib\site-packages\django\conf\__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "C:\Program Files (x86)\Python\lib\site-packages\django\conf\__init__.py", line 157, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Program Files (x86)\Python\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'djangoproject'
It should just run with no error and run the server.

Your Django file structure should look like this:
djangoproject/
manage.py
djangoproject/
__init__.py
settings.py
urls.py
wsgi.py
__init__.py tells Python to treat the parent directory as a module.
ModuleNotFoundError: No module named 'djangoproject'
By rearranging the folder structure, you've stopped Python from treating that folder as a module. Manage.py needs that module to perform its operations.

Related

ModuleNotFoundError: No module named configs.Environment

I'm trying to run this project https://github.com/Progyan1997/fastapi-example
locally, but I'm getting the following error:
Process SpawnProcess-1:
Traceback (most recent call last):
File "/home/omar/.pyenv/versions/3.8.13/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/home/omar/.pyenv/versions/3.8.13/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/omar/.local/share/virtualenvs/fastapi-example-tXminANK/lib/python3.8/site-packages/uvicorn/subprocess.py", line 76, in subprocess_started
target(sockets=sockets)
File "/home/omar/.local/share/virtualenvs/fastapi-example-tXminANK/lib/python3.8/site-packages/uvicorn/server.py", line 60, in run
return asyncio.run(self.serve(sockets=sockets))
File "/home/omar/.pyenv/versions/3.8.13/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "uvloop/loop.pyx", line 1501, in uvloop.loop.Loop.run_until_complete
File "/home/omar/.local/share/virtualenvs/fastapi-example-tXminANK/lib/python3.8/site-packages/uvicorn/server.py", line 67, in serve
config.load()
File "/home/omar/.local/share/virtualenvs/fastapi-example-tXminANK/lib/python3.8/site-packages/uvicorn/config.py", line 458, in load
self.loaded_app = import_from_string(self.app)
File "/home/omar/.local/share/virtualenvs/fastapi-example-tXminANK/lib/python3.8/site-packages/uvicorn/importer.py", line 24, in import_from_string
raise exc from None
File "/home/omar/.local/share/virtualenvs/fastapi-example-tXminANK/lib/python3.8/site-packages/uvicorn/importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "/home/omar/.pyenv/versions/3.8.13/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/omar/Desktop/Learning/fastapi-example/./main.py", line 5, in <module>
from configs.Environment import get_environment_variables
ModuleNotFoundError: No module named 'configs.Environment'
I have gone through the steps and installed Pipenv. But it still crashes with same error.
Python 3.8.13
pipenv, version 2022.5.2
It looks like a typo in the repo, try changing from configs.Environment to from configs.environment
If it will help, please create PR to this repo, help opensource!

Getting error while running heroku run python manage.py migrate

I am a beginner in heroku and django and I am trying to create an application. While I was importing my database to heroku by running command -
heroku run python manage.py migrate
I get an error saying -
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 373, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 417, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 87, in wrapped
saved_locale = translation.get_language()
File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/translation/__init__.py", line 182, in get_language
return _trans.get_language()
File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/translation/__init__.py", line 50, in __getattr__
if settings.USE_I18N:
File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/__init__.py", line 84, in __getattr__
self._setup(name)
File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/__init__.py", line 71, in _setup
self._wrapped = Settings(settings_module)
File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/__init__.py", line 179, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pp'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/manage.py", line 22, in <module>
main()
File "/app/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 386, in run_from_argv
connections.close_all()
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/utils.py", line 208, in close_all
for alias in self:
File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/connection.py", line 73, in __iter__
return iter(self.settings)
File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/connection.py", line 45, in settings
self._settings = self.configure_settings(self._settings)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/utils.py", line 144, in configure_settings
databases = super().configure_settings(databases)
File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/connection.py", line 50, in configure_settings
settings = getattr(django_settings, self.settings_name)
File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/__init__.py", line 84, in __getattr__
self._setup(name)
File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/__init__.py", line 71, in _setup
self._wrapped = Settings(settings_module)
File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/__init__.py", line 179, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pp'
What should I do to successfully import my database to heroku and get it working? Please let me know if I need to add any of my files on here.
This is my directory layout in visual studio code -
Django directory

When I run my Django project developed on Windows on Ubuntu it gives errors as below, even after creating virtualenv and configured properly

Here is the errors
I have installed and created virtualenv as same like the one on Windows and replaced it on Ubuntu with that new one. I could activate the virtual but when I do python3 manage.py runserver it gives error as like below. If someone help, it will be grateful.
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 61, in execute
super().execute(*args, **options)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 96, in handle
self.run(**options)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 105, in run
self.inner_run(None, **options)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run
self.check(display_num_errors=True)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/base.py", line 423, in check
databases=databases,
File "/home/pema/.local/lib/python3.6/site-packages/django/core/checks/registry.py", line 76, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/home/pema/.local/lib/python3.6/site-packages/django/urls/resolvers.py", line 416, in check
for pattern in self.url_patterns:
File "/home/pema/.local/lib/python3.6/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/pema/.local/lib/python3.6/site-packages/django/urls/resolvers.py", line 602, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/pema/.local/lib/python3.6/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/pema/.local/lib/python3.6/site-packages/django/urls/resolvers.py", line 595, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/pema/Desktop/Django/devsearch/devsearch/urls.py", line 9, in <module>
path("", include("users.urls"))
File "/home/pema/.local/lib/python3.6/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/pema/Desktop/Django/devsearch/users/urls.py", line 3, in <module>
from. import views
File "/home/pema/Desktop/Django/devsearch/users/views.py", line 8, in <module>
from .forms import CustomUserCreationForm, ProfileForm, SkillForm
File "/home/pema/Desktop/Django/devsearch/users/forms.py", line 1, in <module>
from dataclasses import fields
ModuleNotFoundError: No module named 'dataclasses'
Data classes were introduced in Python 3.7. You are running Python 3.6.

Django - After installing "Bootstrap4" with pip, got syntax error on settings.py

After installing "Bootstrap4" using pip, add tags in html files, and adding it in requirements.txt and settings.py, do migrate but it shows this:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Mehrab\menv\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\Mehrab\menv\lib\site-packages\django\core\management\__init__.py", line 345, in execute
settings.INSTALLED_APPS
File "C:\Users\Mehrab\menv\lib\site-packages\django\conf\__init__.py", line 83, in __getattr__
self._setup(name)
File "C:\Users\Mehrab\menv\lib\site-packages\django\conf\__init__.py", line 70, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\Mehrab\menv\lib\site-packages\django\conf\__init__.py", line 177, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 779, in exec_module
File "<frozen importlib._bootstrap_external>", line 916, in get_code
File "<frozen importlib._bootstrap_external>", line 846, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\~\socialize\settings.py", line 72
WSGI_APPLICATION = 'socialize.wsgi.application'
^
SyntaxError: invalid syntax
I didn't find any broblem in settings.py

Python 3.5.2 error UndefinedValueError

My application is configured for use mysql, but when i try to run ./manage.py migrate this error ocours
root#renato-VirtualBox:/home/renato/unb-alerta# ./manage.py migrate
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/renato/unb-alerta/venv/lib/python3.5/site- packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/home/renato/unb-alerta/venv/lib/python3.5/site- packages/django/core/management/__init__.py", line 316, in execute
settings.INSTALLED_APPS
File "/home/renato/unb-alerta/venv/lib/python3.5/site- packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/home/renato/unb-alerta/venv/lib/python3.5/site-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "/home/renato/unb-alerta/venv/lib/python3.5/site- packages/django/conf/__init__.py", line 97, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/home/renato/unb- alerta/venv/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/renato/unb-alerta/unb_alerta/settings.py", line 139, in <module>
cast=db_url,
File "/home/renato/unb-alerta/venv/lib/python3.5/site- packages/decouple.py", line 197, in __call__
return self.config(*args, **kwargs)
File "/home/renato/unb-alerta/venv/lib/python3.5/site- packages/decouple.py", line 77, in __call__
return self.get(*args, **kwargs)
File "/home/renato/unb-alerta/venv/lib/python3.5/site- packages/decouple.py", line 64, in get
raise UndefinedValueError('%s option not found and default value was not defined.' % option)
decouple.UndefinedValueError: DATABASE_URL option not found and default value was not defined.
My .env have DATABASE_URL end my settings.py has this configuration
DATABASES = {
'default': config(
'DATABASE_URL',
cast=db_url,
)
}

Categories

Resources