UPD: improved install process.
This commit is contained in:
96
INSTALL.rst
Normal file
96
INSTALL.rst
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
REQUIREMENTS
|
||||||
|
============
|
||||||
|
- Python 2.7
|
||||||
|
- Python package virtualenv (in most cases this is distributed or installed together with python)
|
||||||
|
- Django (will be installed automatically)
|
||||||
|
- Several additional django related python packages (will be installed automatically)
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
QUICK INSTALLATION FOR THE IMPATIENT
|
||||||
|
====================================
|
||||||
|
python setup.py mkpyenv
|
||||||
|
source env/python/bin/activate
|
||||||
|
python setup.py quickdev
|
||||||
|
|
||||||
|
|
||||||
|
INSTALLATION
|
||||||
|
============
|
||||||
|
|
||||||
|
1. Python Environment
|
||||||
|
---------------------
|
||||||
|
It is strongly recommended to create a separated python environment
|
||||||
|
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:
|
||||||
|
|
||||||
|
``virtualenv --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 files
|
||||||
|
----------------
|
||||||
|
|
||||||
|
* ``python setup.py develop``
|
||||||
|
* ``django-dav-events-admin setup ./env/django``
|
||||||
|
|
||||||
|
The django project directory ('./env/django' within the previous example)
|
||||||
|
will be called *project root* for now on.
|
||||||
|
|
||||||
|
3. 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``
|
||||||
|
|
||||||
|
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
|
||||||
10
MANIFEST.in
10
MANIFEST.in
@@ -1,3 +1,9 @@
|
|||||||
recursive-include dav_events/console_scripts/Resources *.py
|
recursive-include dav_base/console_scripts/django_project_config *.py
|
||||||
recursive-include dav_events/static *
|
recursive-include dav_base/static *
|
||||||
|
recursive-include dav_base/templates *
|
||||||
|
include dav_auth/module.json
|
||||||
|
recursive-include dav_auth/django_project_config *.py
|
||||||
|
recursive-include dav_auth/templates *
|
||||||
|
include dav_events/module.json
|
||||||
|
recursive-include dav_events/django_project_config *.py
|
||||||
recursive-include dav_events/templates *
|
recursive-include dav_events/templates *
|
||||||
|
|||||||
63
README.rst
63
README.rst
@@ -5,71 +5,12 @@ This is the DAV Events django project.
|
|||||||
|
|
||||||
REQUIREMENTS
|
REQUIREMENTS
|
||||||
============
|
============
|
||||||
- Python 2.7
|
See INSTALL.rst
|
||||||
- Django
|
|
||||||
- Several additional django related python packages
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
INSTALLATION
|
INSTALLATION
|
||||||
============
|
============
|
||||||
|
See INSTALL.rst
|
||||||
1. Python Environment
|
|
||||||
---------------------
|
|
||||||
It is strongly recommended to create a separated python environment
|
|
||||||
for your 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, confirm_status with step 2.
|
|
||||||
|
|
||||||
- Create the python environment in a directory called ./env/python:
|
|
||||||
|
|
||||||
``virtualenv --prompt="(dav)" ./env/python``
|
|
||||||
|
|
||||||
- If you use a posix compatible shell (like bash, the linux default shell),
|
|
||||||
you have to enter the environment with the following command:
|
|
||||||
|
|
||||||
``source ./env/python/bin/activate``
|
|
||||||
|
|
||||||
Your shell prompt should show the prefix '(dav)' now.
|
|
||||||
|
|
||||||
Do not leave the environment (nor exit the shell) until the whole
|
|
||||||
installation is done.
|
|
||||||
After that you can call the command ``deactivate`` to leave.
|
|
||||||
|
|
||||||
If you have left the environment and want to reenter it (e.g. to execute
|
|
||||||
a python command) use the previous ``source ...`` command.
|
|
||||||
|
|
||||||
2. Install files
|
|
||||||
----------------
|
|
||||||
|
|
||||||
* ``python setup.py develop``
|
|
||||||
* ``django-dav-events-admin setup ./env/django``
|
|
||||||
|
|
||||||
The django project directory ('./env/django' within the previous example)
|
|
||||||
will be called project root for now on.
|
|
||||||
|
|
||||||
3. Create the database schema / Populate the database
|
|
||||||
-----------------------------------------------------
|
|
||||||
Change into the *project root* (where the file ``manage.py`` lives)
|
|
||||||
and run
|
|
||||||
|
|
||||||
* ``python manage.py makemigrations``
|
|
||||||
* ``python manage.py migrate``
|
|
||||||
|
|
||||||
4. 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
|
|
||||||
|
|
||||||
|
|
||||||
LICENCE
|
LICENCE
|
||||||
|
|||||||
59
setup.py
59
setup.py
@@ -21,7 +21,7 @@ class SetupPythonEnvironment(MyCommand):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
python_bin = sys.executable if sys.executable else 'python'
|
python_bin = sys.executable if sys.executable else 'python'
|
||||||
path = 'env/python'
|
path = os.path.join('env', 'python')
|
||||||
prompt = '(dav)'
|
prompt = '(dav)'
|
||||||
|
|
||||||
print('Creating new python environment in {path}'.format(path=path))
|
print('Creating new python environment in {path}'.format(path=path))
|
||||||
@@ -30,12 +30,50 @@ class SetupPythonEnvironment(MyCommand):
|
|||||||
' {path}'.format(bin=python_bin, path=path, prompt=prompt))
|
' {path}'.format(bin=python_bin, path=path, prompt=prompt))
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
|
||||||
print('Depending on your operating system and shell,')
|
print('')
|
||||||
print('you should enter the new environment by running')
|
print('Depending on your operating system or command shell,')
|
||||||
print('ONE of the following commands:')
|
print('you should activate the new environment for this shell session')
|
||||||
print('> source %s/bin/activate' % path)
|
print('by running ONE of the following commands:')
|
||||||
print('> %s/Scripts/activate.bat' % path)
|
print('- Windows: %s' % os.path.join(path, 'Scripts', 'activate'))
|
||||||
print('> %s/Scripts/activate.ps1' % path)
|
print('- C Shell: source %s/bin/activate.csh' % path)
|
||||||
|
print('- All others: source %s/bin/activate' % path)
|
||||||
|
|
||||||
|
|
||||||
|
class QuickSetup(MyCommand):
|
||||||
|
description = 'create a typical installation for developing'
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
python_bin = sys.executable if sys.executable else 'python'
|
||||||
|
django_project_path = 'env/django'
|
||||||
|
mgmt_script = os.path.join(django_project_path, 'manage.py')
|
||||||
|
|
||||||
|
sys.stdout.write('Install distribution in development mode...\n')
|
||||||
|
self.run_command('develop')
|
||||||
|
|
||||||
|
sys.stdout.write('Setup django project in {}...\n'.format(django_project_path))
|
||||||
|
cmd = 'django-dav-admin setup {}'.format(django_project_path)
|
||||||
|
os.system(cmd)
|
||||||
|
|
||||||
|
sys.stdout.write('Enable modules...\n')
|
||||||
|
modules = ['dav_auth', 'dav_events']
|
||||||
|
for m in modules:
|
||||||
|
cmd = '{bin} {mgmt} enable_module {module}'.format(bin=python_bin,
|
||||||
|
mgmt=mgmt_script,
|
||||||
|
module=m)
|
||||||
|
os.system(cmd)
|
||||||
|
|
||||||
|
sys.stdout.write('Make database migrations...\n')
|
||||||
|
cmd = '{bin} {mgmt} makemigrations'.format(bin=python_bin, mgmt=mgmt_script)
|
||||||
|
os.system(cmd)
|
||||||
|
|
||||||
|
sys.stdout.write('Create database...\n')
|
||||||
|
cmd = '{bin} {mgmt} migrate'.format(bin=python_bin, mgmt=mgmt_script)
|
||||||
|
os.system(cmd)
|
||||||
|
|
||||||
|
sys.stdout.write('Create superuser \'root\'...\n')
|
||||||
|
cmd = ('{bin} {mgmt} createsuperuser'
|
||||||
|
' --username root').format(bin=python_bin, mgmt=mgmt_script)
|
||||||
|
os.system(cmd)
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info.major != 2:
|
if sys.version_info.major != 2:
|
||||||
@@ -46,12 +84,13 @@ if sys.version_info.major != 2:
|
|||||||
setup(
|
setup(
|
||||||
name='django-dav-events',
|
name='django-dav-events',
|
||||||
version='1.0',
|
version='1.0',
|
||||||
description='A django based web application project to submit DAV Events.',
|
description='A django based web application project to organize DAV Events.',
|
||||||
url='https://www.heinzelwelt.de',
|
url='https://heinzel.alpenverein-karlsruhe.de',
|
||||||
maintainer='Jens Kleineheismann',
|
maintainer='Jens Kleineheismann',
|
||||||
maintainer_email='heinzel@heinzelwelt.de',
|
maintainer_email='heinzel@alpenverein-karlsruhe.de',
|
||||||
cmdclass={
|
cmdclass={
|
||||||
'mkpyenv': SetupPythonEnvironment,
|
'mkpyenv': SetupPythonEnvironment,
|
||||||
|
'quickdev': QuickSetup,
|
||||||
},
|
},
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
|
|||||||
Reference in New Issue
Block a user