I have just updated my site from Django-CMS 2.3 to 2.4, and from Django 1.4.3 to Django 1.5.1.
The site runs fine on my dev environment; at first it gives me the welcome to Django-CMS page (with the pony), and then I just had to run through each page in the admin panel, and press "publish draft" on it to make it appear.
When I tried to repeat the trick on prod though, all goes well until I try to press "publish draft" on the home page. The other pages are ok, but this page gives me the error message:
Field 'moderator_state' doesn't have a default value
I can preview the page fine, but it won't publish.
Can anyone suggest what I might be doing wrong?
thanks!
Have a look through the upgrade guide and make sure to apply DB migrations:
python manage.py migrate cms
Also, the moderator option is no longer in use so make sure to remove it from the settings.py
Related
I have enabled google login in my Django web application. right now what happens is, when i click on login the url is as follows: it takes me to this page (please find the image below) which i want to prevent but can't figure out how do i.
here is the image
Please assist.
I have uninstalled Django-allauth using the following command :
pip uninstall django-allauth
After that I have installed an older version of that using:
pip install django-allauth==0.45
Then:
python manage.py makemigrations
pytthon manage.py migrate
Done. This solved the problem
This behavior was released in version 0.47.0:
Added a new setting SOCIALACCOUNT_LOGIN_ON_GET that controls whether or not the endpoints for initiating a social login (for example, “/accounts/google/login/”) require a POST request to initiate the handshake. As requiring a POST is more secure, the default of this new setting is False.
You can add the flag in your settings.py file to avoid the intermediate page:
SOCIALACCOUNT_LOGIN_ON_GET=True
And keep using the latest version of the library.
I start with Django 2.0.2 course. I discovered that in chrome I get on http://127.0.0.1:8000/ the Django Home page, in Firefox Dev. as well. On opening http://127.0.0.1:8000/admin in chrome it works as expected http://127.0.0.1:8000/admin/login/?next=/admin/. However in firefox I get 'no such table: Django_session'.
I work in Windows 10, virtualenv created by pipenv.
What is wrong?
You probably need to run python manage.py migrate command to create django_sessions table in your database.
I upgraded our existing site to Wagtail 2.3 from Wagtail 2.1, everything went smoothly and it works fine.
I saw support for Django 2.1 was included, so I upgraded Django - it successfully applied the migrations but froze before script completion. I had to close the terminal window to stop it (cntl-c didn't work).
I also could not login to the site - runserver would freeze up the same way. I tried this with Django 2.1, 2.1.1, 2.1.2, 2.1.3, 2.1.4 - all with the same results.
I've downgraded to Django 2.0.9 and everything is working fine. I'm not sure if this is a Django bug, a Wagtail bug, or a project bug. There is no output when running migrate or runserver.
I did look at my Postgres processes - it looked like it was freezing up while trying to read permissions for a user or something related to the content types.
I'm looking for ideas on what else I can check to debug this.
I have a test site which I am (trying) to get deployed to an Ubuntu 16.04 server.
If I run the site using the Django server (python manage.py runserver 0.0.0.0:8000), I can see all of the apps when I visit the admin page as the superuser, and everything is fine.
However, when I run the site normally, using wsgi, the only apps I can see (and interact with) in the admin are for the users and groups. None of the apps I have created are visible, and if I try and navigate to a change list page for one of them for example, I get a page not found.
I believe my mod_wsgi set up is ok, in that I can view the admin and login, so I don't believe this is the problem.
Perhaps it's a permissions issue?
Any help much appreciated!
UPDATE
In the django shell, on the server, I have run
from django.conf import settings
print(settings.INSTALLED_APPS)
and this prints out the list of apps I would expect to be displayed in the admin
UPDATE 2
Having come back to the live site overnight, the apps are now showing in the admin - but I have no idea why, because they weren't yesterday and I haven't made any changes.
I'm going to answer my question. I ask this so that other people who is still searching on how to create a django "site" will have a clear answer.
The django documentation had show how to use the django site framework. But strangely, after googling for quite a while, I can't find a good instruction on how to install the site framework. We all know to install an app, we put 'django.contrib.sites' on the INSTALLED_APP list. But how to add the site? Using the admin interface will result in error that say that the site framework is installed but no site is configured (Duhh!). So, we have to assign SITE_ID on the setting.py. But what is the id? From some source, we know that the it has installed a default site by the domain example.com. But still what is the id? setting it to 0 or 1 will also result in error.
Just read the link:
http://www.allbuttonspressed.com/projects/djangoappengine
Definitely the best tutorial I have found:
Flying with Django on GAE
With this I had my site on appspot after about half an hour.
The answer is....
First, put 'django.contrib.sites' on the installed app list like usual.
Then run
python manage.py syncdb
(At you project directory that is). Then, run:
python manage.py shell
Then, use the following sequence of code:
>>>import django.contrib.sites.models as mod
>>>mod.Site.objects.all().count()
Make sure it prints out 1. If it doesn't you probably haven't run syncdb properly.
>>>msite=mod.Site.objects.all().get()
>>>msite.pk
It will print your default site id. SITE_ID (in setting.py.)to the number given. That should do it. At least on development server.
ps: Strangely, mine is 383L. Not 0 or 1. This is probably google app engine with django nonrel specific.