Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mrsarm/django-coleman

A very simple Task Management web app written with Django Admin
https://github.com/mrsarm/django-coleman

django django-admin python3 task-manager webapplication

Last synced: 1 day ago
JSON representation

A very simple Task Management web app written with Django Admin

Awesome Lists containing this project

README

        

Run in production mode
======================

To run in production mode, you must install a WSGI compliant server
like *uWSGI* or *Gunicorn*. Also run a production-ready database like
PostgreSQL or MySQL.

To run the project with uWSGI server at port 8000, and connect
with a Postgres database named ``dcoleman_dev``
(or other specified in the environment variable ``DATABASE_URL``),
execute::

$ uwsgi uwsgi.ini

Before run the first time, install the dependencies with::

$ pip install -r requirements/requirements-prod.txt

The static resources must served with a HTTP server
like *Nginx* or *Apache HTTP*. To collect all static resources
in the folder ``static/``, execute once::

$ python3 manage.py collectstatic

Nginx configuration
-------------------

This is an example of how should looks like a *Nginx* configuration
file for Django Coleman::

server {
listen 80;
server_name django-coleman;
access_log /var/log/nginx/django.access.log;
error_log /var/log/nginx/django.error.log;

root /path/to/project/django-coleman;

location /static {
}

location / {
proxy_pass http://127.0.0.1:8000;
}

proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

With the above configuration, the Admin interface should be accessible
at http://django-coleman/admin

If you can't see the Admin page correctly, and the browser console shows
you *403 Forbidden* errors, ensure the system user that runs the Nginx server
has permissions to access to the Django Coleman resources.

Also be sure to have mapped `django-coleman` in your DNS server, or in the
`/etc/hosts` where you want to access the app::

echo '127.0.0.1 django-coleman' | sudo tee -a /etc/hosts

PostgreSQL database
-------------------

If you want to use a PostgreSQL database (recommended), before run
the `migration scripts `_
be sure to create the user and the database used by Django Coleman.
In the ``run.sh`` script is used this string connection
as example: ``postgresql://dcoleman:postgres@localhost/dcoleman_dev``,
so to create a database ``dcoleman_dev`` with a user ``dcoleman`` and a
password ``postgres``, first create the user with::

$ sudo -u postgres createuser --createdb --no-superuser --no-createrole --pwprompt dcoleman

If you are already logged-in as a superuser, you can execute instead the following, within the SQL session:
``CREATE USER dcoleman;``, and then to be prompted for a password within a ``psql`` session
execute ``\password dcoleman``.

Then create the database with::

$ sudo -u postgres psql
postgres=# CREATE DATABASE dcoleman_dev OWNER dcoleman;

Another way to create user and database in Postgres is to use
the Procfile task ``createdb``, checkout the section below.

Docker and Procfile
-------------------

**Docker**: check out the "Docker" section in the ``_ file.

**Procfile**: provided in the source code, the ``web``
task allows to launch the webserver, checkout the `<.env.example>`_
file and the ``_ guides of how to use
it with *Honcho*.