test newest stuff from master on stage #75
67
INSTALL.rst
67
INSTALL.rst
@@ -1,19 +1,27 @@
|
|||||||
REQUIREMENTS
|
REQUIREMENTS
|
||||||
============
|
============
|
||||||
- Python 3
|
- Python >= 3.12
|
||||||
- Python package virtualenv (in most cases this is distributed or installed together with python)
|
- Django and some other python packages, that will be installed throughout
|
||||||
- Django (will be installed automatically)
|
the installation process
|
||||||
- Several additional django related python packages (will be installed automatically)
|
|
||||||
|
|
||||||
For production use you surly want a real web server that supports WSGI
|
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.
|
(e.g. Apache httpd with mod_wsgi) and a real Database like PostgreSQL (psycopg2).
|
||||||
|
|
||||||
|
|
||||||
QUICK INSTALLATION FOR THE IMPATIENT
|
QUICK INSTALLATION FOR THE IMPATIENT
|
||||||
====================================
|
====================================
|
||||||
- python setup.py mkpyenv
|
- python -m venv ./etc/python
|
||||||
- source env/python/bin/activate
|
- source env/python/bin/activate
|
||||||
- python setup.py quickdev
|
- python -m pip install -r requirements.txt
|
||||||
|
- python -m pip install -e .
|
||||||
|
- django-dav-events-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
|
INSTALLATION
|
||||||
@@ -24,14 +32,9 @@ INSTALLATION
|
|||||||
It is strongly recommended to create a separated python environment
|
It is strongly recommended to create a separated python environment
|
||||||
for this django project. But it is not exactly necessary.
|
for this django project. But it is not exactly necessary.
|
||||||
|
|
||||||
The creation of a separated python environment is very easy with the
|
|
||||||
virtualenv tool (a python package).
|
|
||||||
|
|
||||||
If you decide to not use virtualenv, proceed with step 2.
|
|
||||||
|
|
||||||
- Create the python environment in a directory called ./env/python:
|
- Create the python environment in a directory called ./env/python:
|
||||||
|
|
||||||
``virtualenv --prompt="(dav)" ./env/python``
|
``python -m venv --prompt="(dav)" ./env/python``
|
||||||
|
|
||||||
- If you use a posix compatible shell (like bash, the linux default shell),
|
- If you use a posix compatible shell (like bash, the linux default shell),
|
||||||
you have to activate the environment for the current shell session
|
you have to activate the environment for the current shell session
|
||||||
@@ -50,16 +53,29 @@ 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
|
reactivate the environment (e.g. to execute a python command) use the
|
||||||
previous ``source ...`` command.
|
previous ``source ...`` command.
|
||||||
|
|
||||||
2. Install files
|
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.
|
||||||
|
|
||||||
- ``python setup.py develop``
|
|
||||||
- ``django-dav-events-admin setup ./env/django``
|
- ``django-dav-events-admin setup ./env/django``
|
||||||
|
|
||||||
The django project directory ('./env/django' within the previous example)
|
5. Enable modules
|
||||||
will be called *project root* for now on.
|
|
||||||
|
|
||||||
3. Enable modules
|
|
||||||
-----------------
|
-----------------
|
||||||
Our web application consist of several modules, that care about single
|
Our web application consist of several modules, that care about single
|
||||||
aspects of the whole picture.
|
aspects of the whole picture.
|
||||||
@@ -71,6 +87,8 @@ and run
|
|||||||
|
|
||||||
- ``python manage.py enable_module dav_auth``
|
- ``python manage.py enable_module dav_auth``
|
||||||
- ``python manage.py enable_module dav_events``
|
- ``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
|
4. Create the database schema / Populate the database
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
@@ -94,3 +112,12 @@ While you still are in the *project root* directory, run
|
|||||||
Now you should be able to connect to the test server via
|
Now you should be able to connect to the test server via
|
||||||
|
|
||||||
http://localhost:8000
|
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.
|
||||||
|
|
||||||
|
|||||||
20
Makefile
20
Makefile
@@ -1,20 +0,0 @@
|
|||||||
PYTHON := python
|
|
||||||
|
|
||||||
DEPLOY_DIR ?= /var/www/wsgi/django-dav-events
|
|
||||||
|
|
||||||
.PHONY: default help test deploy
|
|
||||||
|
|
||||||
default: help
|
|
||||||
|
|
||||||
help:
|
|
||||||
@echo "The make stuff is used by our CI/CD buildbot."
|
|
||||||
|
|
||||||
test:
|
|
||||||
tox
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
git -C "$(DEPLOY_DIR)/src/django-dav-events" pull
|
|
||||||
"$(DEPLOY_DIR)/python/bin/python" "$(DEPLOY_DIR)/django/manage.py" migrate --noinput
|
|
||||||
"$(DEPLOY_DIR)/python/bin/python" "$(DEPLOY_DIR)/django/manage.py" collectstatic --noinput
|
|
||||||
touch "$(DEPLOY_DIR)/django/main/wsgi.py"
|
|
||||||
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
ABOUT
|
ABOUT
|
||||||
=====
|
=====
|
||||||
This is the DAV Events django project.
|
django-dav-events is a django based web app to drive the
|
||||||
|
"Touren- & Kurseportal" of
|
||||||
|
"Sektion Karlsruhe im Deutschen Alpenverein (DAV) e.V."
|
||||||
|
|
||||||
|
|
||||||
REQUIREMENTS
|
REQUIREMENTS
|
||||||
|
|||||||
6
requirements.txt
Normal file
6
requirements.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
babel
|
||||||
|
django<3.3
|
||||||
|
django-bootstrap3
|
||||||
|
django-countries
|
||||||
|
django-datetime-widget2
|
||||||
|
setuptools
|
||||||
44
setup.py
44
setup.py
@@ -6,17 +6,7 @@ from setuptools import setup, find_packages
|
|||||||
from setuptools import Command
|
from setuptools import Command
|
||||||
|
|
||||||
|
|
||||||
class MyCommand(Command):
|
class SetupPythonEnvironment(Command):
|
||||||
user_options = []
|
|
||||||
|
|
||||||
def initialize_options(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def finalize_options(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class SetupPythonEnvironment(MyCommand):
|
|
||||||
description = 'create a (virtual) python environment'
|
description = 'create a (virtual) python environment'
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@@ -54,7 +44,7 @@ class SetupPythonEnvironment(MyCommand):
|
|||||||
print('- All others: source %s/bin/activate' % path)
|
print('- All others: source %s/bin/activate' % path)
|
||||||
|
|
||||||
|
|
||||||
class QuickSetup(MyCommand):
|
class QuickSetup(Command):
|
||||||
description = 'create a typical installation for developing'
|
description = 'create a typical installation for developing'
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@@ -92,10 +82,19 @@ class QuickSetup(MyCommand):
|
|||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
|
||||||
|
|
||||||
|
def get_long_description():
|
||||||
|
path = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
file = os.path.join(path, 'README.rst')
|
||||||
|
with open(file) as f:
|
||||||
|
return f.read()
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='django-dav-events',
|
name='django-dav-events',
|
||||||
version='2.1.2',
|
version='2.2.1',
|
||||||
description='A django based web application project to organize DAV Events.',
|
description='A django based web application project to drive the Touren- & Kurseportal of DAV Karlsruhe.',
|
||||||
|
long_description=get_long_description(),
|
||||||
|
long_description_content_type='text/x-rst',
|
||||||
url='https://dev.heinzelwerk.de/git/DAV-KA/django-dav-events',
|
url='https://dev.heinzelwerk.de/git/DAV-KA/django-dav-events',
|
||||||
author='Jens Kleineheismann',
|
author='Jens Kleineheismann',
|
||||||
author_email='heinzel@alpenverein-karlsruhe.de',
|
author_email='heinzel@alpenverein-karlsruhe.de',
|
||||||
@@ -105,26 +104,9 @@ setup(
|
|||||||
},
|
},
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
test_suite='tests.test_suite',
|
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
'django-dav-admin = dav_base.console_scripts.admin:main',
|
'django-dav-admin = dav_base.console_scripts.admin:main',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
install_requires=[
|
|
||||||
'babel',
|
|
||||||
#'django >= 1.11, < 2.0',
|
|
||||||
'django >= 1.11, < 3.3',
|
|
||||||
# 'django-extensions',
|
|
||||||
'django-bootstrap3',
|
|
||||||
'django-countries',
|
|
||||||
'django-datetime-widget2',
|
|
||||||
'pytz',
|
|
||||||
'selenium',
|
|
||||||
'setuptools',
|
|
||||||
'coverage',
|
|
||||||
],
|
|
||||||
extras_require={
|
|
||||||
'production': ['psycopg2'],
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|||||||
29
tox.ini
29
tox.ini
@@ -1,10 +1,29 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist = py311, py312
|
envlist = fresh, coverage
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
recreate = false
|
|
||||||
setenv =
|
setenv =
|
||||||
PYTHONPATH = .
|
PYTHONPATH = .
|
||||||
commands = python --version
|
deps = -r{toxinidir}/requirements.txt
|
||||||
python -m coverage run tests
|
selenium
|
||||||
coverage report --skip-covered
|
commands_pre = python --version
|
||||||
|
python -m django --version
|
||||||
|
commands = python tests
|
||||||
|
|
||||||
|
[testenv:fast]
|
||||||
|
description = Only run the testsuite
|
||||||
|
|
||||||
|
[testenv:fresh]
|
||||||
|
description = Run tests in freshly created environment (with coverage)
|
||||||
|
recreate = true
|
||||||
|
deps = {[testenv]deps}
|
||||||
|
coverage
|
||||||
|
commands_pre = {[testenv]commands_pre}
|
||||||
|
python -m coverage --version
|
||||||
|
commands = python -m coverage run tests
|
||||||
|
|
||||||
|
[testenv:coverage]
|
||||||
|
description = Report test coverage
|
||||||
|
deps = {[testenv:fresh]deps}
|
||||||
|
commands = python -m coverage report --skip-covered
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user