Tips and Tricks
Tip #1: Issue related to flatpages
During tests or migration, you may encounter an error like this:
django.db.migrations.exceptions.NodeNotFoundError: Migration main.0001_initial dependencies reference nonexistent parent node ('flatpages', '0001_initial')
You should know that the management of static pages is done via a Django flatpages application. Since this application is not specific to Esup-Pod, its installation directory is located directly in the virtual environment. Typically, depending on your version of Python and your virtual environment, it is:
/home/pod/.virtualenvs/django_pod4/lib/python3.11/site-packages/django/contrib/flatpages
Case 1: Issue during the initial creation of the database
If you run the following command multiple times, deleting the database data, via:
(django_pod4) pod@pod:~/django_projects/podv4$ make createDB
This should no longer happen because, since Esup-Pod v4, make createDB now runs the following command to delete the flatpages migration files, in addition to the Pod applications:
(django_pod4) pod@pod:~/django_projects/podv4$ python manage.py delete_flatpages_migrations.py
⚠️ Be careful not to run this command without understanding the consequences.
Case 2: Issue during unit tests
If you are developing Esup-Pod and encounter this error during unit tests, for example via:
(django_pod4) pod@pod:~/django_projects/podv4$ python manage.py test pod.video.tests --settings=pod.main.test_settings
This is likely due to the configuration of the USE_DOCKER parameter.
If you are in a non-containerized environment, please add the following to your settings_local.py:
USE_DOCKER = false
Tip #2: Issue with django-chunked-upload
If you encounter an issue with the django-chunked-upload application, do not hesitate to run the following commands:
(django_pod4) pod@pod:~/django_projects/podv4$ pip uninstall django-chunked-upload
(django_pod4) pod@pod:~/django_projects/podv4$ pip install -r requirements.txt
Tip #3: Issue with django-shibboleth-remoteuser
If you encounter an issue with the django-shibboleth-remoteuser application, do not hesitate to run the following commands:
(django_pod4) pod@pod:~/django_projects/podv4$ pip uninstall django-shibboleth-remoteuser
(django_pod4) pod@pod:~/django_projects/podv4$ pip install -r requirements.txt
Tip #4: Error when running make updatedb
When updating the database with make updatedb (or creating migrations with
python3 manage.py makemigrations), an error like the following may occur:
Running migrations:
Applying flatpages.0002_flatpage_content_en_flatpage_content_fr_and_more...Traceback (most recent call last):
...
MySQLdb.OperationalError: (1060, "Duplicate column name 'content_en'")
This error is related to the use of the Django flatpages application when
upgrading Django to a different version.
To fix it:
- Back up the entire database, as well as the
django_flatpagetable separately. - Remove the four affected columns from this table:
content_en,content_fr,title_en, andtitle_fr. - Delete all rows from the
django_flatpagetable. - Run
make updatedbagain. - Restore the table rows from the backup.
⚠️ Do not modify the
django_flatpagetable until you have verified your backups.
Tip #5: Invalid links to older draft videos
If links to older draft videos no longer work after migrating from an Esup-Pod
v3 server to a v4 server, this is usually caused by a change to the SECRET_KEY
value in settings_local.py.
Restore the previous SECRET_KEY value to make these links work again.