mirror of
https://github.com/wger-project/wger.git
synced 2026-02-18 00:17:51 +01:00
Upodate installation instructions
These was easier thanks to the docker files.
This commit is contained in:
@@ -3,21 +3,10 @@
|
||||
Development
|
||||
===========
|
||||
|
||||
First, install all required packages::
|
||||
|
||||
$ sudo apt-get install python-virtualenv python3-dev nodejs npm
|
||||
$ virtualenv python-django
|
||||
$ source python-django/bin/activate
|
||||
|
||||
.. note::
|
||||
For python2 some packages have slightly different names such as ``python-dev``
|
||||
|
||||
.. note::
|
||||
You probably want to install some external libraries for the Pillow imaging
|
||||
library, otherwise the thumbnailer might not be able to resize the images::
|
||||
|
||||
$ sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libwebp-dev
|
||||
First, create a virtual environment::
|
||||
|
||||
$ virtualenv --python python3 venv-wger
|
||||
$ source venv-wger/bin/activate
|
||||
|
||||
Get the code and start the application. This will create a SQlite database
|
||||
and populate it with data on the first run::
|
||||
|
||||
@@ -24,11 +24,9 @@ Installation and development
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
development
|
||||
install
|
||||
commands
|
||||
i18n
|
||||
docker
|
||||
|
||||
|
||||
|
||||
|
||||
161
docs/install.rst
161
docs/install.rst
@@ -1,12 +1,13 @@
|
||||
.. _install:
|
||||
|
||||
Installation (production)
|
||||
=========================
|
||||
Installation
|
||||
============
|
||||
|
||||
This file gives a broad description of the necessary steps to install wger on a
|
||||
production environment with apache as a webserver. Since this is a regular
|
||||
django application, refer to its documentation if your setup differs. For a
|
||||
development setup refer to :doc:`development`
|
||||
This file gives a broad description of the necessary steps to install wger
|
||||
on a debian based linux distribution. If your setup differs (e.g. in Red Hat
|
||||
based distros the package names are slightly different) you will need to
|
||||
change the steps but in the end, this is a regular django application so it
|
||||
should run wherever django runs.
|
||||
|
||||
The application is compatible and regularly tested with
|
||||
|
||||
@@ -18,144 +19,36 @@ installation.
|
||||
|
||||
|
||||
|
||||
Databasse
|
||||
---------
|
||||
Base
|
||||
----
|
||||
|
||||
postgreSQL
|
||||
~~~~~~~~~~
|
||||
These are the necessary packages for both development and production
|
||||
(node and npm are only used to download JS and CSS libraries)::
|
||||
|
||||
Install the postgres server and create a database and a user::
|
||||
sudo apt-get install nodejs nodejs-legacy npm git \
|
||||
python-virtualenv python3-dev \
|
||||
libjpeg8-dev zlib1g-dev libwebp-dev
|
||||
|
||||
createdb wger
|
||||
psql wger
|
||||
CREATE USER wger;
|
||||
GRANT ALL PRIVILEGES ON DATABASE wger to wger;
|
||||
.. note::
|
||||
The application is developed with python 3, which these installation
|
||||
instructions also use. If you want to use python 2.7, make sure you install
|
||||
the appropriate packages (e.g. python-dev instead of python3-dev, etc.)!
|
||||
|
||||
|
||||
sqlite
|
||||
~~~~~~
|
||||
|
||||
No further steps necessary.
|
||||
|
||||
|
||||
Apache
|
||||
------
|
||||
|
||||
Install apache and the WSGI module::
|
||||
|
||||
sudo apt-get install apache2 libapache2-mod-wsgi-py3 nodejs npm
|
||||
sudo vim /etc/apache2/apache2.conf
|
||||
|
||||
|
||||
Configure apache to serve the application::
|
||||
|
||||
>>>
|
||||
WSGIScriptAlias / /home/myuser/wger/wger/wsgi.py
|
||||
WSGIPythonPath /home/myuser/wger:/home/myuser/venv-wger/lib/python3.4/site-packages
|
||||
|
||||
<Directory /home/myuser/wger>
|
||||
<Files wsgi.py>
|
||||
Require all granted
|
||||
</Files>
|
||||
</Directory>
|
||||
|
||||
|
||||
<VirtualHost *:80>
|
||||
Alias /static/ /home/myuser/static/
|
||||
<Directory /home/myuser/static>
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
Alias /media/ /home/myuser/media/
|
||||
<Directory /home/myuser/media/>
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
</VirtualHost>
|
||||
|
||||
|
||||
|
||||
Application
|
||||
Development
|
||||
-----------
|
||||
|
||||
Install the necessary packages to create a virtualenv for python (note that you
|
||||
might need to install more if you want the thumbnailer to be able to support
|
||||
more image formats, consult the documentation for pillow for more details)::
|
||||
|
||||
sudo apt-get install git python3-dev python-virtualenv
|
||||
virtualenv --python python3 venv-wger
|
||||
source venv-wger/bin/activate
|
||||
|
||||
If using sqlite, create a folder for it (must be writable by the apache user
|
||||
so you can just give it the folder with chown)::
|
||||
|
||||
mkdir db
|
||||
chmod o+w db
|
||||
|
||||
touch db/database.sqlite
|
||||
chmod o+w database.sqlite
|
||||
For development consult the :doc:`development` section.
|
||||
|
||||
|
||||
Production
|
||||
----------
|
||||
|
||||
Create folders to collect all static resources and save uploaded files (must
|
||||
be readable by the apache process)::
|
||||
|
||||
mkdir static
|
||||
|
||||
mkdir media
|
||||
chmod o+w media
|
||||
|
||||
Get the application::
|
||||
|
||||
git clone https://github.com/rolandgeider/wger.git
|
||||
cd wger
|
||||
pip install -r requirements.txt
|
||||
npm install bower
|
||||
invoke create_settings --settings-path ./settings.py
|
||||
|
||||
Edit your ``settings.py`` file and set the database, ``SITE_URL``,
|
||||
``STATIC_ROOT`` and ``MEDIA_ROOT``::
|
||||
For a more production-like setting with apache and mod-wsgi consult the
|
||||
:doc:`production` chapter.
|
||||
|
||||
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': u'/home/myuser/db/database.sqlite',
|
||||
'USER': '',
|
||||
'PASSWORD': '',
|
||||
'HOST': '',
|
||||
'PORT': '',
|
||||
}
|
||||
}
|
||||
Docker
|
||||
------
|
||||
|
||||
>>> SITE_URL anpassen
|
||||
>>> STATIC_ROOT = '/home/myuser/static'
|
||||
>>> MEDIA_ROOT = '/home/myuser/wger/media'
|
||||
|
||||
Run the installation scritpt, this will load all initial data::
|
||||
|
||||
invoke bootstrap_wger --settings-path /path/to/settings.py --no-start-server
|
||||
|
||||
|
||||
Start.py will create a default administator user (you probably want to change
|
||||
the password as soon as you log in):
|
||||
|
||||
* **username**: admin
|
||||
* **password**: admin
|
||||
|
||||
Collect all static resources::
|
||||
|
||||
python manage.py collectstatic
|
||||
|
||||
|
||||
.. _other-changes:
|
||||
|
||||
Other changes
|
||||
-------------
|
||||
|
||||
If you want to use the application as a public instance, you will probably want to
|
||||
change the following templates:
|
||||
|
||||
* **tos.html**, for your own Terms Of Service here
|
||||
* **about.html**, for your contact address or other such legal requirements
|
||||
There are docker images available, see the :doc:`docker` chapter.
|
||||
140
docs/production.rst
Normal file
140
docs/production.rst
Normal file
@@ -0,0 +1,140 @@
|
||||
Production
|
||||
==========
|
||||
|
||||
Wger user
|
||||
---------
|
||||
|
||||
It is recommended to add a dedicated user for the application::
|
||||
|
||||
sudo adduser wger --disabled-password --gecos ""
|
||||
|
||||
The following steps assume you did, but it is not necessary (nor is it
|
||||
necessary to call it 'wger'). In that case, change the paths as needed.
|
||||
|
||||
Apache
|
||||
------
|
||||
|
||||
Install apache and the WSGI module::
|
||||
|
||||
sudo apt-get install apache2 libapache2-mod-wsgi-py3
|
||||
sudo vim /etc/apache2/sites-available/wger.conf
|
||||
|
||||
|
||||
Configure apache to serve the application::
|
||||
|
||||
WSGIScriptAlias / /home/wger/src/wger/wsgi.py
|
||||
WSGIPythonPath /home/wger/src:/home/wger/venv/lib/python3.4/site-packages
|
||||
|
||||
<Directory /home/wger/src>
|
||||
<Files wsgi.py>
|
||||
Require all granted
|
||||
</Files>
|
||||
</Directory>
|
||||
|
||||
|
||||
<VirtualHost *:80>
|
||||
Alias /static/ /home/wger/static/
|
||||
<Directory /home/wger/static>
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
Alias /media/ /home/wger/media/
|
||||
<Directory /home/wger//media>
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
</VirtualHost>
|
||||
|
||||
Activate the settings and disable apache's default::
|
||||
|
||||
RUN a2dissite 000-default.conf
|
||||
RUN a2ensite wger
|
||||
service apache2 reload
|
||||
|
||||
Database
|
||||
---------
|
||||
|
||||
postgreSQL
|
||||
~~~~~~~~~~
|
||||
|
||||
Install the postgres server and create a database and a user::
|
||||
|
||||
sudo apt-get install postgresql
|
||||
su - postgres
|
||||
createdb wger
|
||||
psql wger -c "CREATE USER wger WITH PASSWORD wger";
|
||||
psql wger -c "GRANT ALL PRIVILEGES ON DATABASE wger to wger";
|
||||
|
||||
|
||||
sqlite
|
||||
~~~~~~
|
||||
|
||||
If using sqlite, create a folder for it (must be writable by the apache user)::
|
||||
|
||||
mkdir db
|
||||
touch db/database.sqlite
|
||||
chmod -R o+w db
|
||||
|
||||
Application
|
||||
-----------
|
||||
|
||||
Make a virtualenv for python and activate it::
|
||||
|
||||
virtualenv --python python3 /home/wger/venv
|
||||
source /home/wger/venv/bin/activate
|
||||
|
||||
Create folders to collect all static resources and save uploaded files. The
|
||||
``static`` folder will only contain CSS and JS files, so it must be readable
|
||||
by the apache process while ``media`` will contain the uploaded files and must
|
||||
be writeable as well::
|
||||
|
||||
mkdir static
|
||||
|
||||
mkdir media
|
||||
chmod o+w media
|
||||
|
||||
Get the application::
|
||||
|
||||
git clone https://github.com/rolandgeider/wger.git /home/wger/src
|
||||
cd /home/wger/src
|
||||
npm install bower
|
||||
pip install -r requirements.txt
|
||||
pip install psycopg2 # Only if using postgres
|
||||
invoke create_settings \
|
||||
--settings-path /home/wger/src/settings.py \
|
||||
--database-path /home/wger/db/database.sqlite
|
||||
|
||||
If you are using postgres, you need to edit the settings file and set the
|
||||
correct values for the database (use ``django.db.backends.postgresql_psycopg2``
|
||||
for the engine). Also set ``MEDIA_ROOT`` to ``/home/wger/media`` and
|
||||
``STATIC_ROOT`` to ``/home/wger/static``.
|
||||
|
||||
Collect all static resources::
|
||||
|
||||
python manage.py collectstatic
|
||||
|
||||
|
||||
Run the installation script, this will load all initial data::
|
||||
|
||||
invoke bootstrap_wger --settings-path /path/to/settings.py --no-start-server
|
||||
|
||||
|
||||
The bootstrap command will also create a default administrator user (you probably
|
||||
want to change the password as soon as you log in):
|
||||
|
||||
* **username**: admin
|
||||
* **password**: admin
|
||||
|
||||
|
||||
.. _other-changes:
|
||||
|
||||
Other changes
|
||||
-------------
|
||||
|
||||
If you want to use the application as a public instance, you will probably want to
|
||||
change the following templates:
|
||||
|
||||
* **tos.html**, for your own Terms Of Service here
|
||||
* **about.html**, for your contact address or other such legal requirements
|
||||
Reference in New Issue
Block a user