2👍
not been able to solve this a django way so i tried using sql, i created a dump of just the database like this.
pg_dump mypgdatabase | gzip -c > mypgdatabase.dump.out.gz
then moved it to the server
scp /path/to/mypgdatabase.dump.out.gz my_remote_server
then recreated it on the server like this
psql -d mypgdatabase -f mypgdatabase.dump.out
then run
./manange.py migrate --all
and all when well.
8👍
You may be calling a site object before creating site model(before syncdb)
ex: site = Site.objects.get(id=settings.SITE_ID)
5👍
This issue continues to plague many, including myself. Although a tedious process, this approach saves me the brain power:
Disable all external apps in your INSTALLED_APPS, except your own apps, like so:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.flatpages',
'main', # This is my own app.
# 'compressor',
# 'ckeditor',
# 'imagekit',
# 'debug_toolbar',
# 'rest_framework',
# 'allauth',
# 'allauth.account',
# 'allauth.socialaccount',
# 'allauth.socialaccount.providers.google',
# 'allauth.socialaccount.providers.facebook',
)
Run
python manage.py makemigrations
python manage.py migrate
Then, uncomment all the other apps, then repeat makemigrations and migrate above.
That works all the time for me
- How to cache a model method in django?
- What is the usage of `FilteredRelation()` objects in Django ORM (Django 2.X)?
- Django_auth_ldap no module named ldap
- Django form and i18n
- Django.core.paginator Ajax pagination with jQuery
4👍
I can’t see your models or what apps are you using, but my guess is that you are using django_site (Site model) and you don’t have ‘django.contrib.sites’ in the INSTALLED_APPS.
If I’m correct then just add 'django.contrib.sites',
to your INSTALLED_APPS
.
- Django rest framework logging different levels on different files
- Django (1.10) override AdminSite
- How to get all POST request values in Django?
4👍
Had this strange issue while initiating a new database and using django-debug-toolbar. Removed it from the INSTALLED_APPS
and was able to run syncdb
. Then re-added debug_toolbar and it was still working fine.
If you’re using django-debug-toolbar, try to comment out debug_toolbar
in your installed apps and try again.
Update: Please follow the steps for the explicit setup: http://django-debug-toolbar.readthedocs.org/en/1.2.2/installation.html#explicit-setup
- Problem with Python logging RotatingFileHandler in Django website
- Installed pytest but running `pytest` in bash returns `not found`
- Exposing django admin to users. Harmful?
3👍
i have same problem and fixed it like this:
- add
SITE_ID=1
intosettings.py
-
run this command :
python manage.py migrate
- 'WSGIRequest' object has no attribute 'Post'
- Django. Invalid keyword argument for this function. ManyToMany
- Configuring root logger in python
1👍
Couple of things you can try and check:
- Your
settings.py
should have aSITE_ID
usually= 1
- Change order of your
INSTALLED_APPS
in yoursettings.py
and try temporarily commenting items out. - As Geo said, check that you’re not calling a site object before creating site model (ex:
site = Site.objects.get(id=settings.SITE_ID)
).
Once you got it working, remember to manage.py makemigrations APP_NAME
as I found cases where it seem to have then avoided the commenting out step.
- Amazon + Django each 12 hours appears that [Errno 5] Input/output error
- EOFError: marshal data too short
- Making Django admin display the Primary Key rather than each object's Object type
- Django: How to add Chinese support to the application
- TypeError object is not iterable
0👍
I overcame this issue with the following order in INSTALLED_APPS
:
INSTALLED_APPS = (
'django.contrib.sites',
'allauth',
'allauth.account',
# my other apps,
)
- Django DateTimeField says 'You are 5.5 hours ahead of server time.'
- Jquery ajax form success callback not being called
0👍
My "commenting out" pattern was slightly different than the accepted answers (as shown below). That is to say, it might be unique depending on the values of various dependencies scattered throughout your app. If commenting out the values above throws an error message, I recommend commenting out the apps that throw the error message and uncommenting accordingly until it works for you. This may be a little "brute force" but it should get the job done.
INSTALLED_APPS = [
# django native apps
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
"django.forms",
'django.contrib.gis',
# 'django.contrib.flatpages',
#third party apps
#django-allauth apps
'allauth',
# 'allauth.account',
# 'allauth.socialaccount',
# 'allauth.socialaccount.providers.facebook',
# 'allauth.socialaccount.providers.google',
# 'allauth.socialaccount.providers.twitter',
# 'allauth.socialaccount.providers.github',
# my apps
'app0',
'app1',]
#MIGRATION_MODULES = {"sites": "mysite.contrib.sites.migrations"}
- In Django admin, can I require fields in a model but not when it is inline?
- Django manage.py runserver verbosity
- Passing arguments to management.call_command on a django view
- Polymorphism in Django models
- Django JSON De-serialization Security