4👍
Make migrations will solve the problem.
Run below commands:
python ./manage.py migrate
python ./manage.py makemigrations
2👍
Try this
from os.path import dirname, abspath
ROOT = dirname(abspath(__file__)).replace('\\', '/') + '/'
print "self.__name__: " + __name__
print "self.__file__: " + __file__
print "ROOT: " + ROOT
import django
print "django.__path__: "
print (django.__path__)
# Contact for error messages etc. - dont forget the ',' after the first entry
ADMINS = (('dev', 'dev@example.com'),)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ROOT + 'project.db',
'USER': '', 'PASSWORD': '',
'HOST': '', 'PORT': '',
}
}
and check if you need + ‘/’ + before the database name for your operating system.
- [Django]-How to fix "fatal error: Carbon/Carbon.h: No such file or directory", when trying to deploy to Heroku – (Django)
- [Django]-Dynamic plotting using Django and matplotlib
- [Django]-Search multiple fields of django model without 3rd party app
- [Django]-How to fetch last 24 hours records from database
1👍
SESSION_ENGINE
it’s using django.contrib.sessions.backends.db
by default and that’s make you need to :
- put
django.contrib.sessions
inINSTALLED_APPS
list variable insettings.py
- you must migrate your database
if you don’t want to do that, just put SESSION_ENGINE
to django.contrib.sessions.backends.cache
in your settings.py
.
so, in your settings.py
like this :
...
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
...
by the way, as in the documentation say :
‘..the simple cache is faster because it disregards persistence.’
you can cek in this link
0👍
If you have added/updated table in any models.py file, you might need to migrate the db before running the server.
Run below commands before running ‘python manage.py runserver’:
python manage.py migrate
python manage.py makemigrations
- [Django]-Is it possible to include a custom 404 view for a Django app without changing anything at the project level?
- [Django]-Django Multiple Levels Choices for Field
- [Django]-Django: Add number of results
- [Django]-Django Haystack + Elasticsearch strange intermittent bug
0👍
That happens when you run the server without a database created or the session table inside of it (in case you recently add the admin
app to your INSTALLED_APPS
). In order to create the database or the table run this command.
python manage.py migrate
In older versions of django is this command
python manage.py syncdb
- [Django]-AttributeError: 'SigSafeLogger' object has no attribute 'logger'
- [Django]-Model integrity check in django
- [Django]-How does one create a custom 403 page in Django?
0👍
It prompted you to that error page because your Database wasn’t even created, which lead to the absence of the mandatory tables to access the admin page.
Run the following two commands :
python3 manage.py migrate
python3 manage.py makemigrations
Running the first command actually creates your database which holds the necessary starter tables. I had the same problem and this solved 100% for me.
Solution source : @satya ‘s answer
- [Django]-DjangoRest Serializer returns empty object
- [Django]-ProgrammingError: when using order_by and distinct together in django
- [Django]-Django problem with extends template tag
-1👍
Executing in the below order works fine:
First
python manage.py migrate
Then
python manage.py runserver.
Since we are applying all migrations before running the server.
- [Django]-Hosting Admin Media Locally During Development
- [Django]-Python google ouath authentication decode and verify id_token
- [Django]-Errno 13 Permission denied Django Upload File
- [Django]-Django-allauth returns error "Reverse … with arguments '()' and keyword arguments '{}' not found"