Skip to content

Instantly share code, notes, and snippets.

@corentinbettiol
Last active January 24, 2023 16:10
Embed
What would you like to do?
Automated install of django + django-cms + djangocms-blog website!

As of 24/01/2023, here's my automated script used to create a basic working project with django 3.2, django-cms 3.11.1 and djangocms-blog using a venv, python3 and pip on a linux environment:

  • Just copy/paste this (will download the chunk of bad code you can see below, and then execute it):

    wget https://gist.githubusercontent.com/corentinbettiol/69601ea572d6eb162ec8e838f1f923ba/raw/djangocms_installer.sh
    chmod +x djangocms_installer.sh
    bash djangocms_installer.sh
    echo "Thanks for using this gist\!"; select choices in "Remove djangocms_installer.sh" "Just exit"; do case $choices in "Remove djangocms_installer.sh" ) rm djangocms_installer.sh && echo "file deleted\!" || break;; "Just exit" ) echo "ok bye\!" && break;; esac; done
    
  • Visit http://localhost:8000 (or http://localhost:8000/?edit, user is admin, password is admin).

  • That's all folks!

  • Press ctrl + C to quit program (you will be asked if you want to remove the file you just downloaded).


Requirements

  • bash
  • python3
  • python3-venv
  • python3-pip

Other useful snippets:

mkdir mydumbproject && cd mydumbproject
wget https://gist.githubusercontent.com/corentinbettiol/69601ea572d6eb162ec8e838f1f923ba/raw/requirements.txt
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install -r requirements.txt
djangocms mydumbproject --cms-version stable
sed -i -e '1h;2,$H;$!d;g' -re "s/(INSTALLED_APPS\s?=\s?\[\n( '._a-zA-Z0-9,\n)*)/\1 'aldryn_apphooks_config',\n/g" mydumbproject/mydumbproject/settings.py
sed -i -e '1h;2,$H;$!d;g' -re "s/(INSTALLED_APPS\s?=\s?\[\n( '._a-zA-Z0-9,\n)*)/\1 'parler',\n/g" mydumbproject/mydumbproject/settings.py
sed -i -e '1h;2,$H;$!d;g' -re "s/(INSTALLED_APPS\s?=\s?\[\n( '._a-zA-Z0-9,\n)*)/\1 'taggit',\n/g" mydumbproject/mydumbproject/settings.py
sed -i -e '1h;2,$H;$!d;g' -re "s/(INSTALLED_APPS\s?=\s?\[\n( '._a-zA-Z0-9,\n)*)/\1 'taggit_autosuggest',\n/g" mydumbproject/mydumbproject/settings.py
sed -i -e '1h;2,$H;$!d;g' -re "s/(INSTALLED_APPS\s?=\s?\[\n( '._a-zA-Z0-9,\n)*)/\1 'meta',\n/g" mydumbproject/mydumbproject/settings.py
sed -i -e '1h;2,$H;$!d;g' -re "s/(INSTALLED_APPS\s?=\s?\[\n( '._a-zA-Z0-9,\n)*)/\1 'sortedm2m',\n/g" mydumbproject/mydumbproject/settings.py
sed -i -e '1h;2,$H;$!d;g' -re "s/(INSTALLED_APPS\s?=\s?\[\n( '._a-zA-Z0-9,\n)*)/\1 'djangocms_blog',\n/g" mydumbproject/mydumbproject/settings.py
sed -i -e '1h;2,$H;$!d;g' -re "s/(urlpatterns = \[)/\0\n path('taggit_autosuggest\/', include('taggit_autosuggest.urls')),/g" mydumbproject/mydumbproject/urls.py
echo -e "\n\nMETA_SITE_PROTOCOL = 'http'\nMETA_SITE_DOMAIN = 'localhost'" >> mydumbproject/mydumbproject/settings.py
cd mydumbproject && python3 manage.py migrate
python3 manage.py runserver 0.0.0.0:8000
Django<4
djangocms-blog==1.2.3
djangocms-installer==2.0.0
djangocms_bootstrap4
djangocms_file
djangocms_style
djangocms_googlemap
djangocms_video
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment