I have a problem with Django, with the manage.py file - python

I just began with Django, I'm following the steps of a youtube tutorial, but when I want to run this command:
python manage.py runserver
This is the error message:
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x03E82780>
Traceback (most recent call last):
File "D:\Personal\Dev\cfehome\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "D:\Personal\Dev\cfehome\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run
autoreload.raise_last_exception()
File "D:\Personal\Dev\cfehome\lib\site-packages\django\utils\autoreload.py", line 251, in raise_last_exception
six.reraise(*_exception)
File "D:\Personal\Dev\cfehome\lib\site-packages\django\utils\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "D:\Personal\Dev\cfehome\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "D:\Personal\Dev\cfehome\lib\site-packages\django\__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "D:\Personal\Dev\cfehome\lib\site-packages\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "D:\Personal\Dev\cfehome\lib\site-packages\django\apps\config.py", line 94, in create
module = import_module(entry)
File "D:\Personal\Dev\cfehome\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 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\Personal\Dev\cfehome\lib\site-packages\django\contrib\admin\__init__.py", line 4, in <module>
from django.contrib.admin.filters import (
File "D:\Personal\Dev\cfehome\lib\site-packages\django\contrib\admin\filters.py", line 10, in <module>
from django.contrib.admin.options import IncorrectLookupParameters
File "D:\Personal\Dev\cfehome\lib\site-packages\django\contrib\admin\options.py", line 12, in <module>
from django.contrib.admin import helpers, widgets
File "D:\Personal\Dev\cfehome\lib\site-packages\django\contrib\admin\widgets.py", line 151
'%s=%s' % (k, v) for k, v in params.items(),
^
SyntaxError: Generator expression must be parenthesized
Do someone know how can I solve this error?

Follow the path in Your Django App
D:\Personal\Dev\cfehome\lib\site-packages\django\contrib\admin\widgets.py
Next step in line no.151 :
('%s=%s' % (k, v) for k, v in params.items())
You must have to parenthesize this.

Related

I get an error when I install the SWITIFY package, does anyone know what it means?

when I install the package sweetify, I get the following error
Does anyone know what the reason is?
I went through all the steps that were in the main dock
Traceback (most recent call last):
File "C:\Program Files\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Program Files\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\nahid\PycharmProjects\fitshow\venv\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\nahid\PycharmProjects\fitshow\venv\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
autoreload.raise_last_exception()
File "C:\Users\nahid\PycharmProjects\fitshow\venv\lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "C:\Users\nahid\PycharmProjects\fitshow\venv\lib\site-packages\django\core\management\__init__.py", line 398, in execute
autoreload.check_errors(django.setup)()
File "C:\Users\nahid\PycharmProjects\fitshow\venv\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\nahid\PycharmProjects\fitshow\venv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\nahid\PycharmProjects\fitshow\venv\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\nahid\PycharmProjects\fitshow\venv\lib\site-packages\django\apps\config.py", line 228, in create
import_module(entry)
File "C:\Program Files\Python38\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 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\nahid\PycharmProjects\fitshow\venv\lib\site-packages\sweetify\__init__.py", line 1, in <module>
from .sweetify import *
File "C:\Users\nahid\PycharmProjects\fitshow\venv\lib\site-packages\sweetify\sweetify.py", line 5, in <module>
from .encoder import LazyEncoder
File "C:\Users\nahid\PycharmProjects\fitshow\venv\lib\site-packages\sweetify\encoder.py", line 2, in <module>
from django.utils.encoding import force_text
ImportError: cannot import name 'force_text' from 'django.utils.encoding' (C:\Users\nahid\PycharmProjects\fitshow\venv\lib\site-packages\django\utils\encoding.py)
Looks like sweetify is not compatible with Django 4.0. See the changelog: https://docs.djangoproject.com/en/4.0/releases/4.0/#features-removed-in-4-0
django.utils.encoding.force_text() and smart_text() are removed.
Try with older version of django, I recommend 3.2.13 :)
this error is coming from django v4 . according to django documentation django.utils.encoding.force_text() and smart_text() are removed.
possible solution :
1 - using Django version 4> add in settings.py :
import django
from django.utils.encoding import force_str
django.utils.encoding.force_text = force_str
Downgrade your django version to django<=3

Getting cannot import name urlresolvers error when running manage.py

I understand that I asked this question an hour or so ago, but it was closed as a duplicate. I have however tried the solutions suggested in the other question, including upgrading my django, making changes to models and utils.py
#from
from django.core import urlresolvers
#to
from django.urls import reverse
but still getting 'cannot import name urlresolvers' as an error when I try run manage.py runserver.
This is the full error
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\threading.py", line 926, in _bootstrap_inne
r
self.run()
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py",
line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\comman
ds\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py",
line 77, in raise_last_exception
raise _exception[1]
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\__init
__.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py",
line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\__init__.py", line 24,
in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\apps\registry.py", lin
e 114, in populate
app_config.import_models()
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\apps\config.py", line
211, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\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 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\allauth\account\models.py", l
ine 17, in <module>
from .utils import user_email
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\allauth\account\utils.py", li
ne 30, in <module>
from ..utils import (import_callable, valid_email_or_none,
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\allauth\utils.py", line 8, in
<module>
from django.core import urlresolvers
ImportError: cannot import name 'urlresolvers' from 'django.core' (C:\Users\User\AppData\Local\Programs\Pyth
on\Python37\lib\site-packages\django\core\__init__.py)
Just to reiterate- I have tried the solutions suggested here -> ImportError: No module named 'django.core.urlresolvers'

django 1.10.5; Error with Postgis db as default backend

I am new to development generally and django. Currently I have the error below when I use the 'python manage.py runserver' command after changing Default Database Engine on setting to
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'agricom',
'USER': 'postgres',
'HOST': 'localhost',
'PASSWORD': 'pass',
'PORT': '5432',
}
}
I get the error below;
cannot import name 'GDALRaster' from 'django.contrib.gis.gdal'
(vrtenv_dj1-105) C:\Users\Kevin\Documents\Django_PJs\agricom>py manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper
at 0x046C46F0>
Traceback (most recent call last):
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\db\utils.py", line 115, in load_backend
return import_module('%s.base' % backend_name)
File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\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 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\contrib\gis\db\backends\postgis\base.py", line 7, in <module>
from .operations import PostGISOperations
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\contrib\gis\db\backends\postgis\operations.py", line 7, in <module>
from django.contrib.gis.gdal import GDALRaster
ImportError: cannot import name 'GDALRaster' from 'django.contrib.gis.gdal' (C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\contrib\gis\gdal\__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\core\management\commands\runserver.py", line 113, in inner_run
autoreload.raise_last_exception()
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\utils\autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\utils\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\apps\registry.py", line 108, in populate
app_config.import_models(all_models)
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\apps\config.py", line 199, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\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 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\contrib\auth\models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\contrib\auth\base_user.py", line 52, in <module>
class AbstractBaseUser(models.Model):
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\db\models\base.py", line 119, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\db\models\base.py", line 316, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\db\models\options.py", line 214, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\db\__init__.py", line 33, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\db\utils.py", line 211, in __getitem__
backend = load_backend(db['ENGINE'])
File "C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\db\utils.py", line 134, in load_backend
raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured: 'django.contrib.gis.db.backends.postgis' isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
'mysql', 'oracle', 'postgresql', 'sqlite3'
Error was: cannot import name 'GDALRaster' from 'django.contrib.gis.gdal' (C:\Users\Kevin\Documents\Django_PJs\vrtenv_dj1-105\lib\site-packages\django\contrib\gis\gdal\__init__.py)
What can I do?
Please find error message below:

Getting error for created new app in python

i am new in python, I have created new app as crud, i am using django, app is created, but when i run the server it gives me below error, not getting what exactl error in that, In mysite/settings.py i have added in INSTALLED_APPS added crud.apps.CrudConfig still getting this error
C:\Users\Nikul\PycharmProjects\mysite>python manage.py runserver
Watching for file changes with StatReloader
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py", line 77, in raise_last_exception
raise _exception[0](_exception[1]).with_traceback(_exception[2])
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\apps\config.py", line 134, in create
% (mod_path, cls_name, ', '.join(candidates))
django.core.exceptions.ImproperlyConfigured: 'crud.apps' does not contain a class 'CrudConfig'. Choices are: 'PollsConfig'.
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:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\commands\runserver.py", line 95, in handle
self.run(**options)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\commands\runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py", line 579, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py", line 564, in start_django
reloader.run(django_main_thread)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py", line 272, in run
get_resolver().urlconf_module
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\resolvers.py", line 564, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\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 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Nikul\PycharmProjects\mysite\mysite\urls.py", line 22, in <module>
path('crud/', include('crud.urls')),
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\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 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Nikul\PycharmProjects\mysite\crud\urls.py", line 3, in <module>
from . import views
File "C:\Users\Nikul\PycharmProjects\mysite\crud\views.py", line 8, in <module>
from .models import Choice, Question
File "C:\Users\Nikul\PycharmProjects\mysite\crud\models.py", line 8, in <module>
class Question(models.Model):
File "C:\Users\Nikul\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\base.py", line 111, in __new__
"INSTALLED_APPS." % (module, name)
RuntimeError: Model class crud.models.Question doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Can anyone please help me what we need to do to resolve that error ?

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