From 933452d5f39ab01f116fe9d04b77a9a712d46c74 Mon Sep 17 00:00:00 2001 From: Roland Date: Thu, 25 Jun 2020 15:47:24 +0200 Subject: [PATCH] Small documentation polishing --- README.rst | 48 ++++++++++------------------ docs/changelog.rst | 4 +-- docs/codingstyle.rst | 19 ++--------- docs/development.rst | 5 ++- docs/docker.rst | 6 ++-- docs/getting_started.rst | 18 ++--------- docs/index.rst | 8 ----- docs/production.rst | 2 +- extras/docker/apache/Dockerfile | 3 +- extras/docker/base/Dockerfile | 3 +- extras/docker/development/Dockerfile | 3 +- 11 files changed, 37 insertions(+), 82 deletions(-) diff --git a/README.rst b/README.rst index e639a088a..c43127cec 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -Thank you for downloading wger Workout Manager. wger (ˈvɛɡɐ) is a free, open source web +docker run -ti -v /path/to/this/checkout:/home/wger/src --name wger.devel --publish 8000:8000 wger/develThank you for downloading wger Workout Manager. wger (ˈvɛɡɐ) is a free, open source web application that manages your exercises and personal workouts, weight and diet plans. It can also be used as a simple gym management utility, providing different administrative roles (trainer, manager, etc.). It offers a REST API as well, for @@ -25,37 +25,13 @@ parameters. Docker ------ -Useful to just try it out:: +Useful to just try it out. Check the documentatio on how to use docker for +development:: docker run -ti --name wger.apache --publish 8000:80 wger/apache Then just open http://localhost:8000 and log in as: **admin**, password **admin** -Alternatively, there are docker images for development as well, ``wger/devel`` -and ``wger/devel-fedora``. Each image contains an instance of the application -running with django's development server using a sqlite database and can be -used to quickly setup a development instance (vim and tmux are already -installed). The only difference is that devel has an ubuntu base image while -devel-fedora uses fedora. - -:: - - $ docker run -ti --name wger.devel --publish 8000:8000 wger/devel - -Then, *within the docker image*, activate the virtualenv - -:: - - $ source ~/venv/bin/activate - -and start the development server - -:: - - $ python manage.py runserver 0.0.0.0:8000 - -Then just open http://localhost:8000 and log in as: **admin**, password **admin** - Development version (from git) ------------------------------ @@ -68,7 +44,7 @@ and stable state. :: - $ sudo apt-get install python3-dev python-virtualenv nodejs npm libjpeg8-dev zlib1g-dev git + $ sudo apt-get install python3-dev nodejs npm git Then install the python packages from pypi in the virtualenv:: @@ -84,7 +60,12 @@ Then install the python packages from pypi in the virtualenv:: $ git clone https://github.com/wger-project/wger.git $ cd wger + $ pip install --upgrade pip + $ pip install wheel + $ pip install -r requirements_forked.txt $ pip install -r requirements.txt # or requirements_devel.txt to develop + $ npm install + $ npm install bower $ python setup.py develop $ wger create_settings \ --settings-path /path/to/current/folder/settings.py \ @@ -108,8 +89,8 @@ Stable version (from PyPI) :: - $ sudo apt-get install python3-dev python-virtualenv nodejs npm libjpeg8-dev zlib1g-dev - $ virtualenv venv-django + $ sudo apt-get install python3-dev nodejs npm git + $ python3 -m venv venv-django $ source venv-django/bin/activate $ pip install wger @@ -117,12 +98,15 @@ Stable version (from PyPI) 2) Start the application. This will download the required JS and CSS libraries and create a SQlite database and populate it with data on the first run. Then, log in as: **admin**, password **admin** + :: - $ wger bootstrap + $ wger bootstrap -3) To start the installation again, just call wger start:: +3) To start the installation again, just call wger start + +:: $ wger start diff --git a/docs/changelog.rst b/docs/changelog.rst index 0e3603467..2717e6795 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -3,11 +3,11 @@ Changelog 1.9 - IN DEVELOPMENT -------------------- -**2017-xx-xx** +**2020-xx-xx** Upgrade steps from 1.8: -* Django update to 1.11: ``pip install -r requirements.txt`` +* Django update to 3.x: ``pip install -r requirements.txt`` * Database upgrade: ``python manage.py migrate`` * Update static files (only production): ``python manage.py collectstatic`` diff --git a/docs/codingstyle.rst b/docs/codingstyle.rst index 6372805f6..d6d984d59 100644 --- a/docs/codingstyle.rst +++ b/docs/codingstyle.rst @@ -6,16 +6,7 @@ Coding Style Guide Python ------ -* Code according to PEP8 - - Check that the code is structured as per pep8 but with a maximum line - length of 100. - -* Code for Python 3 - - While the application should remain compatible with python2, use django's - suggestion to mantain sanity: code for py3 and treat py2 as a backwards - compatibility requirement. If you need, you can use six. +Code according to PEP8, but with but with a maximum line length of 100. Javascript @@ -32,9 +23,5 @@ Javascript Automatic coding style checks ----------------------------- -The coding style is automatically check by Travis-CI. To manually check your -files you can run the following commands: - -* Python: ``pep8 wger`` -* Javascript: ``./node_modules/.bin/gulp lint-js`` (or just ``gulp lint-js`` if - you installed the node libraries globally on your system) +The coding style is automatically checked by GitHub actions after sending a +pull request. diff --git a/docs/development.rst b/docs/development.rst index c50e5ad3a..0e573f5c7 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -26,7 +26,7 @@ Create a virtual environment It's a best practice to create a Python virtual environment:: - $ virtualenv --python python3 venv-wger + $ python3 -m venv venv-wger $ source venv-wger/bin/activate $ cd wger @@ -37,6 +37,9 @@ Install Requirements To install the Python requirements:: $ pip install -r requirements_devel.txt + $ pip install -r requirements_forked.txt + $ npm install + $ npm install bower $ python setup.py develop Install application diff --git a/docs/docker.rst b/docs/docker.rst index c3ddb135d..7b49cf489 100644 --- a/docs/docker.rst +++ b/docs/docker.rst @@ -5,6 +5,8 @@ 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! + Development ----------- @@ -15,7 +17,7 @@ and serves it with django's development server. First build the image:: - docker build -t wger/devel . + docker build -f extras/docker/development/Dockerfile -t wger/devel . Run a container and start the application:: @@ -49,7 +51,7 @@ This image runs the application using WSGI and apache. First build the image:: - docker build --tag wger/apache . + docker build -f extras/docker/apache/Dockerfile --tag wger/apache . Run a container and start the application:: diff --git a/docs/getting_started.rst b/docs/getting_started.rst index e772627e6..b48737747 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -14,7 +14,7 @@ slightly different) you will need to change the steps as appropriate. The application is compatible and regularly tested with * sqlite, postgres -* python 2.7, 3.4, 3.5 and 3.6 +* python 3.6, 3.7 and 3.8 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 @@ -29,21 +29,7 @@ contact page. These are the necessary packages for both development and production (node and npm are only used to download JS and CSS libraries):: - sudo apt-get install nodejs npm git \ - python-virtualenv python3-dev \ - libjpeg8-dev zlib1g-dev libwebp-dev - -On fedora 23:: - - sudo dnf install nodejs npm git \ - python-virtualenv python3-devel \ - libjpeg-turbo-devel zlib-devel - - -.. 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.)! + sudo apt-get install nodejs npm git python3-dev .. toctree:: diff --git a/docs/index.rst b/docs/index.rst index 6e78cfa81..05efb8ff9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -86,11 +86,3 @@ folders for more details. .. include the authors file from the root folder .. include:: ../AUTHORS.rst - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`search` -* :ref:`modindex` - diff --git a/docs/production.rst b/docs/production.rst index e1618accb..030a3ecb2 100644 --- a/docs/production.rst +++ b/docs/production.rst @@ -94,7 +94,7 @@ Application Make a virtualenv for python and activate it:: - virtualenv --python python3 /home/wger/venv + python3 -m venv /home/wger/venv source /home/wger/venv/bin/activate Create folders to collect all static resources and save uploaded files. The diff --git a/extras/docker/apache/Dockerfile b/extras/docker/apache/Dockerfile index 1d6b2d05c..8d0f325e9 100644 --- a/extras/docker/apache/Dockerfile +++ b/extras/docker/apache/Dockerfile @@ -25,7 +25,8 @@ RUN apt-get update \ build-essential \ python3-dev \ python3-pip \ - git + git \ + && rm -rf /var/lib/apt/lists/* # Set up the application COPY . . diff --git a/extras/docker/base/Dockerfile b/extras/docker/base/Dockerfile index 921a513f7..fc06bdc1b 100644 --- a/extras/docker/base/Dockerfile +++ b/extras/docker/base/Dockerfile @@ -14,8 +14,7 @@ LABEL maintainer="Roland Geider " # Install dependencies ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update \ - && apt-get install --no-install-recommends -y \ +RUN apt-get install --no-install-recommends -y \ git \ locales \ nodejs \ diff --git a/extras/docker/development/Dockerfile b/extras/docker/development/Dockerfile index 37f021d6e..4ed7b436f 100644 --- a/extras/docker/development/Dockerfile +++ b/extras/docker/development/Dockerfile @@ -33,7 +33,8 @@ RUN apt-get update \ build-essential \ python3-dev \ python3-pip \ - git + git \ + && rm -rf /var/lib/apt/lists/* # Set up the application COPY . .