DjangoCMS Installation Guide [Date: 19th May 2022]

[Date: 19th May 2022]

Prerequisites:

  1. python
  2. PyCharm

Guided Steps:

1. Go to the "D:\Tutorials\Python\Projects" folder. Create a Project directory with suitable name. Say you created "D:\Tutorials\Python\Projects\tutorialProject".
2. Open powershell in "D:\Tutorials\Python\Projects\tutorialProject" and run the command: 
virtualenv .\\venv
3. Open this folder "D:\Tutorials\Python\Projects\tutorialProject" as a project in PyCharm.
4. Inside PyCharm, go to File->Settings->Project Settings->Project Interpreter.
5. Click wheel besides the project interpreter dropdown and click 'Add'.
6. Use the Virtualenv environment you created in step-2 above to use the python.exe inside the '.\venv\Scripts\' directory.
- Do no check the "Inherit global site-packages" or the "Make available to all projects" options.
7. Run the commands listed below, which are also listed in "ShagunDjangoCMSInstallerScript_v1.0.bat", in the Terminal inside PyCharm.
:: To install the django installer, run:
pip install djangocms-installer

:: install pytz
pip install pytz

:: In the following command, instead of mysite, use a proper sitename.
:: Create your site.
djangocms -f -p . mysite
:: [Note:] Python say that the specified path already exists and isn't empty. So, use the following command instead:
djangocms -s -f -p . mysite
DjangoCMS should have installed the required site packages and created an admin account with username:password being admin:admin. If it did, skip to step-9, else, follow step-8.

8. Run the following command to create a superuser:
python manage.py createsuperuser
Now, the script should prompt you to enter the superuser username, email and password. 

9. To open your website, run the following command:
python manage.py runserver
If you are able to access the default homepage, your djangoCMS installation has succeeded. Now, it's time to configure postgresql, instead of the default sqllite for database.
[Note:] In order to be able to access your website from other computers on your LAN, you can specify host and IP as follows:
python manage.py runserver 0.0.0.0:8000

:: What's discussed here onwards is based on the writeup here: https://docs.django-cms.org/en/latest/how_to/install.html
10. Install the psycopg2 driver for Postgres:
pip install psycopg2

11. Change the DATABASES tag in settings.py to the following:
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'AAI',
        'USER': 'postgres',
        'PASSWORD': '1234567890',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}

12. Migrate the database tables.
- comment all the apps that you or PyCharm have added to INSTALLED_APPS in settings.py. This includes the mysite you created in step-7 above.
- In the PyCharm terminal, run the following command:
python manage.py makemigrations
python manage.py migrate
- uncomment the apps you commented before and do as per the instructions here:
https://stackoverflow.com/questions/46105418/switching-django-cms-project-from-sqlite-to-postgres
https://docs.djangoproject.com/en/4.0/topics/migrations/

13. Check if your configuration is correct using:
python manage.py cms check



Other notable references I may or may not have mentioned above:
  • https://docs.django-cms.org/en/latest/how_to/install.html
  • https://docs.django-cms.org/en/release-3.4.x/introduction/templates_placeholders.html
  • https://www.youtube.com/watch?v=NbsRVfLCE1U

Comments