Skip to main content

The missing app for developers creating and maintaining websites

Project description

django-docrootcms

Docroot 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 cms

Because the code matters

Dependencies

  • Python >= 3.8
  • django >= 2 < 4
  • django-markdownx
  • django-tagulous

Install Instructions

New Install

NOTE: this is only slightly modified from Django docs for easier website maintenance Djano: Writing your first Django application

cd to your start folder location (Ex: ~/websites/)

mkdir example.com
cd example.com

MANUAL STEP: (optional but recommended) be sure to activate your virtual environment if necessary (Ex: pyenv local examplecom) or (Ex: source env/bin/activate)

pip install --upgrade pip
pip install django
django-admin startproject docroot .
pip install django-markdownx
pip install django-tagulous
pip install django-docrootcms

MANUAL STEP: (required) in docroot/settings.py add docrootcms to the beginning of the installed apps block

python manage.py docrootcms install
python manage.py docrootcms update
python manage.py makemigrations
python manage.py migrate
python manage.py collectstatic
python manage.py createsuperuser
python manage.py runserver 0.0.0.0:8000

NOTE: to use the admin you must create a superuser with the command above

Test Urls:

Tutorials & Guides:

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 Install

NOTE: 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 needed

cd to your existing project directory (contains manage.py)

pip install --upgrade pip
pip install --upgrade django-docrootcms
python manage.py startapp docroot
  • copy the original settings.py from a django-admin startproject into the docroot app
  • copy the original urls.py from a django-admin startproject into the docroot app

remove these lines from your existing settings.py file and add this to the top

from docroot.settings import *

remove the url lines from your existing urls.py file and add this to the top

from docroot.urls import *

in docroot/settings.py add docrootcms to the installed apps block

python manage.py docrootcms install
python manage.py docrootcms update
python manage.py makemigrations
python manage.py migrate

NOTE: THIS IS THE CONCEPT I THINK YOU SHOULD TAKE; UNTESTED SO FAR!

Docker Install / New Code (Bound directory)

Install Docker docs.docker.com: Get Docker

First time: To get a blank website to check into GIT repo

I recommend creating a websites directory inside your home directory (Ex: ~/websites/)

cd ~/websites
mkdir example.com_install
cd example.com_install

NOTE: 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.

docker run --rm --name django-docrootcms -p 8000:8000 -v $(pwd):/usr/src/install -e DOCROOTCMS_OWNERSHIP=1001:128 sstacha/django-docrootcms "install.sh"

NOTE: if you are windows/mac you can omit the -e DOCROOTCMS_OWNERSHIP variable; it should not be needed

docker run --rm --name django-docrootcms -p 8000:8000 -v $(pwd):/usr/src/install sstacha/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 repo

cd ~/websites/
mkdir example_com # because pycharm only allows picking a project directory with numbers letters and underscores
git clone <your website project url> .
cp -a ../example.com_install/. .
git add .
git commit -m "initial blank website"
git push

Now we will remove the install folder and we should be good to go

rm -rf ../example.com_install/

rerun docker command binding our website directory; you can run git commands locally or edit files from the shared directory

From now on: To run the container with our bound code directory managed by version control

docker run --rm --name django-docrootcms -p 8000:8000 -v $(pwd):/usr/src/app sstacha/django-docrootcms

Docker Install / Existing Code (Bound Directory)

cd ~/websites/
mkdir example_com
git clone <your website project url> .

run docker command binding our website directory; you can run git commands locally or edit files from the shared directory

From now on: To run the container with our bound code directory managed by version control

docker run --rm --name django-docrootcms -p 8000:8000 -v $(pwd):/usr/src/app sstacha/django-docrootcms

Docker server deployment

For 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_com
    image: sstacha/django-docrootcms
    # restart: unless-stopped
    # command: /bin/bash
    env_file: 
    #  - local.env
    ports:
      - 8000:8000
    volumes:
      # - ./data:/usr/src/app/data/
      - type: bind
        source: $PWD
        target: /usr/src/app

Now you should be able to use docker-compose up and docker-compose down to start and stop the service

To test: open a browser to http://localhost:8000/test/

Tutorials & Guides: ubercode.io: docroot cms tutorials

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_docrootcms-3.4.tar.gz (2.4 MB view details)

Uploaded Source

Built Distribution

django_docrootcms-3.4-py3-none-any.whl (2.5 MB view details)

Uploaded Python 3

File details

Details for the file django_docrootcms-3.4.tar.gz.

File metadata

  • Download URL: django_docrootcms-3.4.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for django_docrootcms-3.4.tar.gz
Algorithm Hash digest
SHA256 b5017994102e9731c59022ff90994eddac55d50711fb97f0aef02cc2a8f165c0
MD5 d93eb18781ae0b0cbf11286b35f2e199
BLAKE2b-256 e1e226c5a63d28ad1f9839e78810d51e0ea79ecee809488f459ecdbc5652e026

See more details on using hashes here.

File details

Details for the file django_docrootcms-3.4-py3-none-any.whl.

File metadata

File hashes

Hashes for django_docrootcms-3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 44197a83e36489b0dd11d63f25b93e533bf0636b6f35cc85a1dbbdef70e0bbeb
MD5 3ac1f2fb189fd05151419cd0f12cddd4
BLAKE2b-256 aeabe0275c9c0c7bcb922faaeaeb01db46b57c322ce6743bfb4f25d6e60b3945

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page