Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Some updates to docs

Roland Geider6d5e56e1d3dd
diff --git a/docs/development.rst b/docs/development.rst
index 3083eb9d5..79446ab98 100644
--- a/docs/development.rst
+++ b/docs/development.rst
@@ -3,61 +3,56 @@
Development
===========
-Assumptions
------------
+You can safely install from master, it is almost always in a usable
+and stable state.
-For clarity purposes regarding these instructions we are assuming the following
+Virtual environment
+~~~~~~~~~~~~~~~~~~~
-* You will be installing the program in ``/home/wger/wger``
+::
+ $ python3 -m venv venv-wger
+ $ source venv-wger/bin/activate
-Requirements
-------------
Get the code
~~~~~~~~~~~~
+::
-The code is available on Github::
-
- $ git clone https://github.com/wger-project/wger.git
-
-Create a virtual environment
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-It's a best practice to create a Python virtual environment::
-
- $ python3 -m venv venv-wger
- $ source venv-wger/bin/activate
- $ cd wger
-
+ $ git clone https://github.com/wger-project/wger.git src
+ $ cd src
+ $ WGER_PATH=$(pwd)
Install Requirements
~~~~~~~~~~~~~~~~~~~~
-
-To install the Python requirements::
+::
$ pip install -r requirements_devel.txt
- $ npm install
$ npm install bower
$ python setup.py develop
Install application
~~~~~~~~~~~~~~~~~~~
-To install the development server, init the database and create a settings
-file::
+This will download the required JS and CSS libraries and create a SQlite
+database and populate it with data on the first run::
+
$ wger create_settings \
- --settings-path /home/wger/wger/settings.py \
- --database-path /home/wger/wger/database.sqlite
+ --settings-path $WGER_PATH/settings.py \
+ --database-path $WGER_PATH/database.sqlite
$ wger bootstrap \
- --settings-path /home/wger/wger/settings.py \
+ --settings-path $WGER_PATH/settings.py \
--no-start-server
+You can of course also use other databases such as postgres or mariaDB. Create
+a database and user and edit the DATABASES settings before calling bootstrap.
+Take a look at the :ref:`prod_postgres` on apache on how that could look like.
+
Start the server
----------------
-To start the server::
+After the first run you can just use django's development server::
$ python manage.py runserver
diff --git a/docs/docker.rst b/docs/docker.rst
index 7b49cf489..a42501045 100644
--- a/docs/docker.rst
+++ b/docs/docker.rst
@@ -5,7 +5,26 @@ There are docker files available to quickly get a version of wger up and
running. They are all located under ``extras/docker`` if you want to build
them yourself.
-Note that you need to build from the project's source folder!
+Note that you need to build from the project's source folder, e.g::
+
+ docker build -f extras/docker/development/Dockerfile -t wger/devel .
+ docker build -f extras/docker/apache/Dockerfile --tag wger/apache .
+
+
+Apache
+------
+
+This image runs the application using WSGI and apache.
+
+Get the image::
+
+ docker pull wger/apache
+
+Run a container and start the application::
+
+ docker run -ti --name wger.apache --publish 8000:80 wger/apache
+
+Then just open http://localhost:8000 and log in as: **admin**, password **admin**
Development
@@ -14,10 +33,9 @@ Development
This image installs the application using virtualenv, uses a sqlite database
and serves it with django's development server.
+Get the image::
-First build the image::
-
- docker build -f extras/docker/development/Dockerfile -t wger/devel .
+ docker pull wger/devel
Run a container and start the application::
@@ -25,12 +43,11 @@ Run a container and start the application::
(in docker) source ~/venv/bin/activate
(in docker) python manage.py runserver 0.0.0.0:8000
-Now you can access the application on port 8000 of your host (probably just
-http://localhost:8000).
+Then just open http://localhost:8000 and log in as: **admin**, password **admin**
-Depending on what you intend to do with it, you might want to map a local folder
-to the container. This is interesting if e.g. you want to keep the wger source
-code on your host machine and use docker only to serve it. Then you can do this::
+As an alternative you might want to map a local folder to the container.
+This is interesting if e.g. you want to keep the wger source code on
+your host machine and use docker only to serve it. Then do this::
docker run -ti \
--name wger.test1 \
@@ -38,24 +55,7 @@ code on your host machine and use docker only to serve it. Then you can do this:
--volume /path/to/local/wger/:/home/wger/src \
wger/devel
-It will mount the local path *on top* of the folder in the container, basically
-exchanging one for the other. Please note that for this to work you need to
-manually checkout the code to ``/path/to/local/wger/`` and create a settings file
-as well.
-
-
-Apache
-------
-
-This image runs the application using WSGI and apache.
-
-First build the image::
-
- docker build -f extras/docker/apache/Dockerfile --tag wger/apache .
-
-Run a container and start the application::
-
- docker run -ti --name wger.apache --publish 8000:80 wger/apache
+It will mount the local path *on top* of the folder in the container. For this to
+work you obviously need to manually checkout the code to ``/path/to/local/wger/``
+and create a settings file as well.
-Now you can access the application on port 8000 of your host (probably just
-http://localhost:8000).
diff --git a/docs/index.rst b/docs/index.rst
index 05efb8ff9..0f6bfe05c 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -19,14 +19,17 @@ https://github.com/wger-project/wger
This documentation is intended for developers and administrators of the software.
-Installation and development
-----------------------------
+Installation and administration
+-------------------------------
+.. toctree::
+
+ installation
+
+
+Development
+-------------------------------
.. toctree::
- :maxdepth: 2
- getting_started
- settings
- commands
tips_and_tricks
codingstyle
i18n
@@ -35,8 +38,9 @@ Installation and development
Administration guide
--------------------
.. toctree::
- :maxdepth: 2
+ commands
+ settings
gym
diff --git a/docs/getting_started.rst b/docs/installation.rst
similarity index 78%
rename from docs/getting_started.rst
rename to docs/installation.rst
index b48737747..268df9e56 100644
--- a/docs/getting_started.rst
+++ b/docs/installation.rst
@@ -1,7 +1,7 @@
-.. _getting_started:
+.. _installation:
-Getting started
-===============
+Installation
+============
You can get a local instance of wger installed in a couple of minutes.
@@ -16,7 +16,7 @@ The application is compatible and regularly tested with
* sqlite, postgres
* python 3.6, 3.7 and 3.8
-You might also want to take a look at the :ref:`other-changes` section for other
+After installation you might also want to take a look at the :ref:`other-changes` section for other
changes you might want to do to your local instance such as Terms of Service or
contact page.
@@ -26,14 +26,12 @@ contact page.
in the development page apply to all the installation options.
-These are the necessary packages for both development and production
-(node and npm are only used to download JS and CSS libraries)::
+These are the necessary packages for both development and production::
- sudo apt-get install nodejs npm git python3-dev
+ sudo apt-get install nodejs npm git python3-dev python3-venv
.. toctree::
- :maxdepth: 2
development
docker
diff --git a/docs/production.rst b/docs/production.rst
index 030a3ecb2..5369292a0 100644
--- a/docs/production.rst
+++ b/docs/production.rst
@@ -65,12 +65,13 @@ Activate the settings and disable apache's default::
Database
--------
+.. _prod_postgres:
postgreSQL
~~~~~~~~~~
Install the postgres server and create a database and a user::
- sudo apt-get install postgresql postgresql-server-dev-9.3 # or appropriate version
+ sudo apt-get install postgresql postgresql-server-dev-12 # or appropriate version
su - postgres
createdb wger
psql wger -c "CREATE USER wger WITH PASSWORD 'wger'";
diff --git a/docs/tips_and_tricks.rst b/docs/tips_and_tricks.rst
index 5a5aa3a02..35ace8884 100644
--- a/docs/tips_and_tricks.rst
+++ b/docs/tips_and_tricks.rst
@@ -45,7 +45,16 @@ Clearing the cache
Sometimes there are changes to the internal changes of the cached structures.
It is recommended that you just clear all the existing caches
-``python manage.py clear-cache --clear-all``
+``python manage.py clear-cache --clear-all`` or just set the timeout to something
+like one second (in settings.py::
+
+ CACHES = {
+ 'default': {
+ 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
+ 'LOCATION': 'wger-cache',
+ 'TIMEOUT': 1
+ }
+ }
Miscellaneous settings
~~~~~~~~~~~~~~~~~~~~~~