Package: django-docrootcms
django-docrootcmsDocroot CMS is a django application for developers who build, manage and maintain websites.  This app takes the simplicity of working with a PHP docroot, the fun of working with Python and fully leverages the power of Django for adding website application functionality.ubercode.io: docroot cmsBecause the code mattersDependenciesPython >= 3.8django >= 2 < 4django-markdownxdjango-tagulousInstall InstructionsNew InstallNOTE: this is only slightly modified from Django docs for easier website maintenanceDjano: Writing your first Django applicationcd to your start folder location (Ex: ~/websites/)mkdirexample.comcdexample.comMANUAL STEP: (optional but recommended) be sure to activate your virtual environment if necessary
(Ex: pyenv local examplecom) or (Ex: source env/bin/activate)pipinstall--upgradepip
pipinstalldjango
django-adminstartprojectdocroot.
pipinstalldjango-markdownx
pipinstalldjango-tagulous
pipinstalldjango-docrootcmsMANUAL STEP: (required) in docroot/settings.py add docrootcms to the beginning of the installed apps blockpythonmanage.pydocrootcmsinstall
pythonmanage.pydocrootcmsupdate
pythonmanage.pymakemigrations
pythonmanage.pymigrate
pythonmanage.pycollectstatic
pythonmanage.pycreatesuperuser
pythonmanage.pyrunserver0.0.0.0:8000NOTE: to use the admin you must create a superuser with the command aboveTest Urls:http://localhost:8000/test/http://localhost:8000/admin/Tutorials & Guides:CMSubercode.io: docroot cms tutorialsDjangodjango tutorial (polls app)NOTE: remember the cms is simply a django app; you can follow any django tutorial to add your own django applications right beside it.  You can skip to the section on creating the polls app since we just did the install steps.Existing InstallNOTE: manage.py commands modify the docroot settings.py and urls.py files.  If this is not the projects settings.py and urls.py you will have to manually merge these changes yourself every time you upgrade the django-docroot-cms app.  This is not recommended.be sure to activate your virtual environment if neededcd to your existing project directory (contains manage.py)pipinstall--upgradepip
pipinstall--upgradedjango-docrootcms
pythonmanage.pystartappdocrootcopy the original settings.py from a django-admin startproject into the docroot appcopy the original urls.py from a django-admin startproject into the docroot appremove these lines from your existing settings.py file and add this to the topfromdocroot.settingsimport*remove the url lines from your existing urls.py file and add this to the topfromdocroot.urlsimport*in docroot/settings.py add docrootcms to the installed apps blockpythonmanage.pydocrootcmsinstall
pythonmanage.pydocrootcmsupdate
pythonmanage.pymakemigrations
pythonmanage.pymigrateNOTE: THIS IS THE CONCEPT I THINK YOU SHOULD TAKE; UNTESTED SO FAR!Docker Install / New Code (Bound directory)Install Dockerdocs.docker.com: Get DockerFirst time: To get a blank website to check into GIT repoI recommend creating a websites directory inside your home directory (Ex: ~/websites/)cd~/websites
mkdirexample.com_installcdexample.com_installNOTE: if you are on linux you will need to sudo chown -R : website/ or set the ownership variable to your user:group ids like the example below
you can find your ids by executing cat /etc/passwd and looking for the line with your username; the first number after the x is the userid the second is the default groupid
it will look something like this -> sstacha:x:1001:1001:Stephen Stacha,,,:/home/sstacha:/bin/bash.  If you want a different group use cat /etc/group and pick the group id you want.dockerrun--rm--namedjango-docrootcms-p8000:8000-v$(pwd):/usr/src/install-eDOCROOTCMS_OWNERSHIP=1001:128sstacha/django-docrootcms"install.sh"NOTE: if you are windows/mac you can omit the -e DOCROOTCMS_OWNERSHIP variable; it should not be neededdockerrun--rm--namedjango-docrootcms-p8000:8000-v$(pwd):/usr/src/installsstacha/django-docrootcms"install.sh"Create a new repo on github like example_com (include python gitignore, others optional) and clone into the current folder.
Copy the files from install folder into the repo clone folder (not the install directory; just the files)
Push them up to your site repocd~/websites/
mkdirexample_com# because pycharm only allows picking a project directory with numbers letters and underscoresgitclone<yourwebsiteprojecturl>.
cp-a../example.com_install/..
gitadd.
gitcommit-m"initial blank website"gitpushNow we will remove the install folder and we should be good to gorm-rf../example.com_install/rerun docker command binding our website directory; you can run git commands locally or edit files from the shared directoryFrom now on: To run the container with our bound code directory managed by version controldockerrun--rm--namedjango-docrootcms-p8000:8000-v$(pwd):/usr/src/appsstacha/django-docrootcmsDocker Install / Existing Code (Bound Directory)cd~/websites/
mkdirexample_com
gitclone<yourwebsiteprojecturl>.run docker command binding our website directory; you can run git commands locally or edit files from the shared directoryFrom now on: To run the container with our bound code directory managed by version controldockerrun--rm--namedjango-docrootcms-p8000:8000-v$(pwd):/usr/src/appsstacha/django-docrootcmsDocker server deploymentFor server deployments you will want docker to handle making sure your application stays up and running.  You will probably
want to use docker-compose.  Paste the following in your site directory example.com as docker-compose.yml:version:'3.4'services:example_com:# (to fix for development); do not use in production# container_name: example_comimage:sstacha/django-docrootcms# restart: unless-stopped# command: /bin/bashenv_file:#  - local.envports:-8000:8000volumes:# - ./data:/usr/src/app/data/-type:bindsource:$PWDtarget:/usr/src/appNow you should be able to use docker-compose up and docker-compose down to start and stop the serviceTo test: open a browser tohttp://localhost:8000/test/Tutorials & Guides:ubercode.io: docroot cms tutorials