124 lines
4.0 KiB
ReStructuredText
124 lines
4.0 KiB
ReStructuredText
REQUIREMENTS
|
|
============
|
|
- Python >= 3.12
|
|
- Django and some other python packages, that will be installed throughout
|
|
the installation process
|
|
|
|
For production use you surly want a real web server that supports WSGI
|
|
(e.g. Apache httpd with mod_wsgi) and a real Database like PostgreSQL (psycopg2).
|
|
|
|
|
|
QUICK INSTALLATION FOR THE IMPATIENT
|
|
====================================
|
|
- python -m venv ./env/python
|
|
- source env/python/bin/activate
|
|
- python -m pip install -r requirements.txt
|
|
- python -m pip install -e .
|
|
- django-dav-admin setup ./env/django
|
|
- python ./env/django/manage.py enable_module dav_auth
|
|
- python ./env/django/manage.py enable_module dav_events
|
|
- python ./env/django/manage.py enable_module dav_registration
|
|
- python ./env/django/manage.py enable_module dav_event_office
|
|
- python ./env/django/manage.py makemigrations
|
|
- python ./env/django/manage.py migrate
|
|
- python ./env/django/manage.py createsuperuser
|
|
|
|
|
|
INSTALLATION
|
|
============
|
|
|
|
1. Python Environment
|
|
---------------------
|
|
It is strongly recommended to create a separated python environment
|
|
for this django project. But it is not exactly necessary.
|
|
|
|
- Create the python environment in a directory called ./env/python:
|
|
|
|
``python -m venv --prompt="(dav)" ./env/python``
|
|
|
|
- If you use a posix compatible shell (like bash, the linux default shell),
|
|
you have to activate the environment for the current shell session
|
|
with the following command:
|
|
|
|
``source ./env/python/bin/activate``
|
|
|
|
Your shell prompt should be prefixed with '(dav)' now.
|
|
|
|
Do not exit the shell session (nor deactivate the environment) until the
|
|
whole installation is done.
|
|
After that you can call the command ``deactivate`` to deactivate the project
|
|
environment and access the systems standard python environment again.
|
|
|
|
If you have left the session or deactivated the environment and want to
|
|
reactivate the environment (e.g. to execute a python command) use the
|
|
previous ``source ...`` command.
|
|
|
|
2. Install requirements
|
|
-----------------------
|
|
|
|
- ``python -m pip install -r requirements.txt``
|
|
|
|
3. Install project code in development mode
|
|
-------------------------------------------
|
|
|
|
- ``python -m pip install -e .``
|
|
|
|
4. Setup django project root
|
|
----------------------------
|
|
|
|
To run a django app, you need a django project root directory, with some
|
|
static and variable files in it.
|
|
In the last step a tool was installed, that can be used to create such
|
|
a project directory with all the neccessary subdirectories and files.
|
|
Our example will create the django project in ./etc/django and we will
|
|
call this directory *project root* for now on.
|
|
|
|
- ``django-dav-events-admin setup ./env/django``
|
|
|
|
5. Enable modules
|
|
-----------------
|
|
Our web application consist of several modules, that care about single
|
|
aspects of the whole picture.
|
|
You want to enable some of those modules by execute a
|
|
management command.
|
|
|
|
Change into the *project root* (where the file ``manage.py`` lives)
|
|
and run
|
|
|
|
- ``python manage.py enable_module dav_auth``
|
|
- ``python manage.py enable_module dav_events``
|
|
- ``python manage.py enable_module dav_registration``
|
|
- ``python manage.py enable_module dav_event_office``
|
|
|
|
4. Create the database schema / Populate the database
|
|
-----------------------------------------------------
|
|
While you still are in the *project root* directory, run
|
|
|
|
- ``python manage.py makemigrations``
|
|
- ``python manage.py migrate``
|
|
|
|
5. Create a super user or administrator account
|
|
-----------------------------------------------
|
|
While you still are in the *project root* directory, run
|
|
|
|
- ``python manage.py createsuperuser``
|
|
|
|
6. Start test server
|
|
--------------------
|
|
While you still are in the *project root* directory, run
|
|
|
|
- ``python manage.py runserver``
|
|
|
|
Now you should be able to connect to the test server via
|
|
|
|
http://localhost:8000
|
|
|
|
7. Configure production web server
|
|
----------------------------------
|
|
For production use you do not want to run the test server,
|
|
but have a real web server like apache or nginx running the
|
|
django app via the WSGI interface.
|
|
The entry point for your WSGI server is the file
|
|
``main/wsgi.py`` within the *project root* directory.
|
|
|