Code Monkey home page Code Monkey logo

cms-django's Introduction

Integreat Django CMS

This project aims to develop a content management system tailored to the needs of municipalities to provide multilingual local information. It aims at being easy to use and easy to maintain over a long time. This project uses Python3 and Django 1.11 and aims at being run on a Ubuntu 18.04.

Development

There are several ways to run this project locally: install as a package (Ubuntu, openSUSE), run in local Python3 venv, and also in a Docker container. Each method is detailed below.

To get started, run

git clone [email protected]:Integreat/cms-django.git
cd cms-django

Development Tools

  • Delete docker environment to start over again: dev-tools/prune_docker.sh (be careful: This will delete all your other docker images as well)
  • Delete database to start over again: dev-tools/prune_database.sh
  • Migrate database: dev-tools/migrate.sh
  • Create superuser: dev-tools/create_superuser.sh

Run CMS in Python3 venv

  1. Install a local PostgreSQL server, for example with apt install postgresql and create a database and database user with the name integreat.
  2. Run ./install-venv.sh
  3. Open the backend/backend/settings.py and adjust the database credentials. Also change the hostname to localhost.
  4. Do the database migrations: integreat-cms migrate
  5. Create the initial superuser: integreat-cms createsuperuser
  6. Fire up the CMS: integreat-cms runserver localhost:8000
  7. Go to your browser and open the URL http://localhost:8000

Run CMS in Docker container

A docker-compose file is provided in the the repository. It will start one container with a PostgreSQL database and another one with the CMS.

  • docker-compose up
  • enter http://localhost:8000
  • as long as there is no standard SQL dump, you have to create your own user: docker exec -it $(docker-compose ps -q django) bash -ic "integreat-cms createsuperuser"

Packaging and installing on Ubuntu 18.04

Packaging for Debian can be done with setuptools.

$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip3 install stdeb
$ python3 setup.py --command-packages=stdeb.command bdist_deb

The project requires the package python3-django-widget-tweaks which has to be build manually:

$ git clone [email protected]:jazzband/django-widget-tweaks.git
$ cd django-widget-tweaks
$ python3 -m venv .venv
$ pip3 install stdeb
$ python3 setup.py --command-packages=stdeb.command bdist_deb

Then install both packages with gdebi:

# apt install gdebi postgresql
# gdebi django-widget-tweaks/deb_dist/python3-django-widget-tweaks_1.4.3-1_all.deb
# gebi cms-django/deb_dist/python3-integreat-cms_0.0.13-1_all.deb

In the end, create a PostgreSQL user and database and adjust the /usr/lib/python3/dist-packages/backend/settings.py.

Troubleshooting

Cleaning up Docker environment

  • stop all conntainers: docker stop $(docker ps -a -q)
  • remove all images: docker rmi $(docker images -a -q)
  • remove all volumes: docker system prune

Misc

  • keep in mind that we are using Python 3.x, so use python3 and pip3 on your bash commands
  • get a bash shell in the django container: docker exec -it $(docker-compose ps -q django) bash
  • enter postgres container: docker exec -it $(docker-compose ps -q postgres) psql -U"integreat" -d "integreat"

Migrations

  • change models
  • docker exec -it $(docker-compose ps -q django) bash -ic "integreat-cms makemigrations [app]"
  • optional, if you want to inspect the corresponding SQL syntax: docker exec -it $(docker-compose ps -q django) bash -ic "integreat-cms sqlmigrate [app] [number]"
  • docker exec -it $(docker-compose ps -q django) bash -ic "integreat-cms migrate"

Docker clean up

  • docker stop $(docker ps -a -q)
  • docker rm $(docker ps -a -q)
  • remove all images: docker rmi $(docker images -a -q)
  • remove all volumes: docker volume prune

i18n

To make use of the translated backend, compile the django.po file as follows:

django-admin compilemessages

If you use a virtual python environment, be sure to use the ´--exclude´ parameter or execute this command in the backend or cms directory, otherwise all the translation files in your venv will be compiled, too.

cms-django's People

Contributors

michael-markl avatar ulliholtgrave avatar timobrembeck avatar sascha11110 avatar svenseeberg avatar thomas125 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.