Self hosted FLOSS fitness/workout, nutrition and weight tracker
Some changes to the installation scripts
Roland Geider32c77deee18a
diff --git a/.bowerrc b/.bowerrcdeleted file mode 100644index e798057df..000000000--- a/.bowerrc+++ /dev/null@@ -1,4 +0,0 @@-{- "directory" : "wger/core/static/bower_components",- "interactive": false-}diff --git a/README.rst b/README.rstindex 7c7f286fd..e0efc9bfc 100644--- a/README.rst+++ b/README.rst@@ -69,7 +69,7 @@ Then install the python packages from pypi in the virtualenv::$ invoke create_settings \--settings-path /home/wger/wger/settings.py \--database-path /home/wger/wger/database.sqlite- $ invoke bootstrap_wger \+ $ invoke bootstrap \--settings-path /home/wger/wger/settings.py \--no-start-server$ python manage.py runserver@@ -130,7 +130,7 @@ Stable version (from PyPI)::- $ wger bootstrap_wger+ $ wger bootstrap3) Log in as: **admin**, password **admin**@@ -144,13 +144,13 @@ The available options for the ``wger`` command (if installed from PyPI) or<command>``::- bootstrap_wger Performs all steps necessary to bootstrap the application+ bootstrap Performs all steps necessary to bootstrap the applicationconfig_location Returns the default location for the settings file and the data foldercreate_or_reset_admin Creates an admin user or resets the password for an existing onecreate_settings Creates a local settings fileload_fixtures Loads all fixturesmigrate_db Run all database migrations- start_wger Start the application using django's built in webserver+ start Start the application using django's built in webserverContact=======diff --git a/docs/changelog.rst b/docs/changelog.rstindex 9477f7699..a5e6e0877 100644--- a/docs/changelog.rst+++ b/docs/changelog.rst@@ -5,6 +5,14 @@ Changelog--------------------**2016-XX-XX**+.. warning ::+ There have been some changes to the installation procedure. Calling 'invoke'+ on its own has been deprecated, you should use the 'wger' command (which+ accepts the same options). Also some of these commands have been renamed:++ * ``start_wger`` to ``wger``+ * ``bootstrap_wger`` ``bootstrap``+Upgrade steps from 1.7:* Django update to 1.9: ``pip install -r requirements.txt``diff --git a/docs/commands.rst b/docs/commands.rstindex 2f0958dae..bda86bb25 100644--- a/docs/commands.rst+++ b/docs/commands.rst@@ -24,17 +24,17 @@ in this manual.You can get a list of all available commands with ``invoke --list`` or ``wger``.While you can do this from any folder in the application, some of them (e.g.-``start_wger``) might only work from the root folder::+``start``) might only work from the root folder::Available tasks:- bootstrap_wger Performs all steps necessary to bootstrap the application+ bootstrap Performs all steps necessary to bootstrap the applicationconfig_location Returns the default location for the settings file and the data foldercreate_or_reset_admin Creates an admin user or resets the password for an existing onecreate_settings Creates a local settings fileload_fixtures Loads all fixturesmigrate_db Run all database migrations- start_wger Start the application using django's built in webserver+ start Start the application using django's built in webserverYou can also get help on a specific command with ``invoke --help <command>``.@@ -43,21 +43,21 @@ You can also get help on a specific command with ``invoke --help <command>``.settings file to use for the operation. If you use it, it is recommended touse absolute paths, for example::- invoke bootstrap_wger --settings-path /path/to/development/wger/settings-test.py+ invoke bootstrap --settings-path /path/to/development/wger/settings-test.py-Bootstrap wger-~~~~~~~~~~~~~~+Bootstrap+~~~~~~~~~-Command: **bootstrap_wger**+Command: **bootstrap**This command bootstraps the application: it creates a settings file, initialisesa sqlite database, loads all necessary fixtures for the application to work andcreates a default administrator user. While it can also work with e.g. a postgreSQLdatabase, you will need to create it yourself::- invoke bootstrap_wger+ invoke bootstrapThe most usual use-case is creating the settings file and the sqlite database totheir default locations, but you can set your own paths if you want e.g. start@@ -65,7 +65,7 @@ developing on a branch that is going to change the database schema.Usage::- Usage: inv[oke] [--core-opts] bootstrap_wger [--options] [other tasks here ...]+ Usage: inv[oke] [--core-opts] bootstrap [--options] [other tasks here ...]Docstring:Performs all steps necessary to bootstrap the application@@ -81,11 +81,11 @@ Usage::Start wger~~~~~~~~~~-Command: **start_wger**+Command: **start**Starts an already installed application::- invoke start_wger+ invoke startPlease note that this is simply a comfort function and does not use any *magic*,it simply calls django's development server and (optionally) opens a browser@@ -94,7 +94,7 @@ is probably better.Usage::- Usage: inv[oke] [--core-opts] start_wger [--options] [other tasks here ...]+ Usage: inv[oke] [--core-opts] start [--options] [other tasks here ...]Docstring:Start the application using django's built in webserverdiff --git a/docs/development.rst b/docs/development.rstindex d90672964..1c37ad27b 100644--- a/docs/development.rst+++ b/docs/development.rst@@ -48,7 +48,7 @@ To install the server::$ invoke create_settings \--settings-path /home/wger/wger/settings.py \--database-path /home/wger/wger/database.sqlite- $ invoke bootstrap_wger \+ $ invoke bootstrap \--settings-path /home/wger/wger/settings.py \--no-start-serverdiff --git a/docs/production.rst b/docs/production.rstindex 49c791f8c..6859526de 100644--- a/docs/production.rst+++ b/docs/production.rst@@ -126,7 +126,7 @@ for the engine). Also set ``MEDIA_ROOT`` to ``/home/wger/media`` andRun the installation script, this will download some CSS and JS libraries andload all initial data::- invoke bootstrap_wger --settings-path /path/to/settings.py --no-start-server+ invoke bootstrap --settings-path /path/to/settings.py --no-start-serverCollect all static resources::diff --git a/extras/docker/apache/Dockerfile b/extras/docker/apache/Dockerfileindex 2321e2ca2..c9254ab4a 100644--- a/extras/docker/apache/Dockerfile+++ b/extras/docker/apache/Dockerfile@@ -29,10 +29,11 @@ RUN virtualenv --python python3 /home/wger/venvRUN . /home/wger/venv/bin/activate \&& pip install --upgrade pip \&& pip install -r requirements.txt \- && invoke create_settings \+ && python setup.py develop \+ && wger create_settings \--settings-path /home/wger/src/settings.py \--database-path /home/wger/db/database.sqlite \- && invoke bootstrap_wger \+ && wger bootstrap \--settings-path /home/wger/src/settings.py \--no-start-serverdiff --git a/extras/docker/development-fedora/Dockerfile b/extras/docker/development-fedora/Dockerfileindex 6902a15ca..ce8e4bae7 100644--- a/extras/docker/development-fedora/Dockerfile+++ b/extras/docker/development-fedora/Dockerfile@@ -17,6 +17,12 @@ RUN dnf update;\nodejs npm libjpeg-turbo-devel zlib-devel git \tmux sudo redhat-rpm-config gcc python-imaging+# Set locale to UTF8, otherwise problems with the encoding can occur+RUN locale-gen en_US.UTF-8+ENV LANG en_US.UTF-8+ENV LANGUAGE en_US:en+ENV LC_ALL en_US.UTF-8+# Add wger userRUN adduser wgerRUN echo "wger ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/wger@@ -32,10 +38,11 @@ RUN virtualenv --python python3 /home/wger/venvRUN . /home/wger/venv/bin/activate \&& pip install --upgrade pip \&& pip install -r requirements_devel.txt \- && invoke create_settings \+ && python setup.py develop \+ && wger create_settings \--settings-path /home/wger/src/settings.py \--database-path /home/wger/db/database.sqlite \- && invoke bootstrap_wger \+ && wger bootstrap \--settings-path /home/wger/src/settings.py \--no-start-server@@ -45,9 +52,11 @@ RUN . /home/wger/venv/bin/activate \# to delete the node_modules folder and install everything again# -> https://github.com/npm/npm/issues/9863# -> https://github.com/npm/npm/issues/13306-RUN rm -r node_modules \+RUN cd wger \+ && rm -r node_modules \&& npm install bower \&& npm install \+ && cd .. \&& mkdir ~/media \&& sed -i "/^MEDIA_ROOT/c\MEDIA_ROOT='\/home\/wger\/media'" settings.py \&& . /home/wger/venv/bin/activate \diff --git a/extras/docker/development/Dockerfile b/extras/docker/development/Dockerfileindex 73a83300c..46ea2406f 100644--- a/extras/docker/development/Dockerfile+++ b/extras/docker/development/Dockerfile@@ -15,6 +15,13 @@ FROM wger/baseMAINTAINER Roland Geider <[email protected]>EXPOSE 8000+# Set locale to UTF8, otherwise problems with the encoding can occur+RUN locale-gen en_US.UTF-8+ENV LANG en_US.UTF-8+ENV LANGUAGE en_US:en+ENV LC_ALL en_US.UTF-8++# Install dependenciesRUN apt-get install -y vim tmux sqlite3@@ -27,10 +34,11 @@ RUN virtualenv --python python3 /home/wger/venvRUN . /home/wger/venv/bin/activate \&& pip install --upgrade pip \&& pip install -r requirements_devel.txt \- && invoke create_settings \+ && python setup.py develop \+ && wger create_settings \--settings-path /home/wger/src/settings.py \--database-path /home/wger/db/database.sqlite \- && invoke bootstrap_wger \+ && wger bootstrap \--settings-path /home/wger/src/settings.py \--no-start-server@@ -40,9 +48,11 @@ RUN . /home/wger/venv/bin/activate \# to delete the node_modules folder and install everything again# -> https://github.com/npm/npm/issues/9863# -> https://github.com/npm/npm/issues/13306-RUN rm -r node_modules \+RUN cd wger \+ && rm -r node_modules \&& npm install bower \&& npm install \+ && cd .. \&& mkdir ~/media \&& sed -i "/^MEDIA_ROOT/c\MEDIA_ROOT='\/home\/wger\/media'" settings.py \&& . /home/wger/venv/bin/activate \diff --git a/manage.py b/manage.pyindex 2f6e4057b..d5c1c05be 100644--- a/manage.py+++ b/manage.py@@ -3,7 +3,7 @@ import sysfrom django.core.management import execute_from_command_line-from tasks import (+from wger.tasks import (setup_django_environment,get_user_config_path)diff --git a/setup.py b/setup.pyindex 1c10d52a7..0c95f7884 100644--- a/setup.py+++ b/setup.py@@ -14,7 +14,7 @@ from setuptools import (from wger import get_version-with open('README.rst') as readme:+with open('README.rst', encoding='utf-8') as readme:long_description = readme.read()with open('requirements.txt') as requirements_production:diff --git a/wger/.bowerrc b/wger/.bowerrcnew file mode 100644index 000000000..6b111d1bc--- /dev/null+++ b/wger/.bowerrc@@ -0,0 +1,4 @@+{+ "directory" : "core/static/bower_components",+ "interactive": false+}diff --git a/wger/__main__.py b/wger/__main__.pyindex 63620b38e..1b36fcb76 100644--- a/wger/__main__.py+++ b/wger/__main__.py@@ -28,6 +28,9 @@ invoke_cmd = 'invoke 'def main():+ # Change the working directory so that invoke can find the tasks fiel+ os.chdir(os.path.dirname(os.path.abspath(__file__)))+args = sys.argv[1:]if len(args):run(invoke_cmd + ' '.join(args), pty=True)diff --git a/package.json b/wger/package.jsonsimilarity index 100%rename from package.jsonrename to wger/package.jsondiff --git a/tasks.py b/wger/tasks.pysimilarity index 91%rename from tasks.pyrename to wger/tasks.pyindex a96f064d3..b2a37f7a6 100644--- a/tasks.py+++ b/wger/tasks.py@@ -16,6 +16,17 @@import sys++#+# This is an ugly and terrible hack, please don't do this!+#+# The reason we do this is that during django's setup later in this script, it+# tries to load the standard library's "mail" module which collides with our+# (perhaps unluckily named) app with the same name. Since this script is only+# used for installation and does not depend on anything from wger proper, it+# is kind of OK to change the system path.+sys.path = sys.path[1:]+import timeimport loggingimport threading@@ -40,7 +51,7 @@ logger = logging.getLogger(__name__)'browser': 'Whether to open the application in a browser window. Default: false','settings-path': 'Path to settings file (absolute path recommended). Leave empty for default','extra-args': 'Additional arguments to pass to the builtin server. Pass as string: "--arg1 --arg2=value". Default: none'})-def start_wger(context, address='localhost', port=8000, browser=False, settings_path=None, extra_args=''):+def start(context, address='localhost', port=8000, browser=False, settings_path=None, extra_args=''):'''Start the application using django's built in webserver'''@@ -64,13 +75,13 @@ def start_wger(context, address='localhost', port=8000, browser=False, settings_'port': 'Port to use. Default: 8000','browser': 'Whether to open the application in a browser window. Default: false','start-server': 'Whether to start the development server. Default: true'})-def bootstrap_wger(context,- settings_path=None,- database_path=None,- address='localhost',- port=8000,- browser=False,- start_server=True):+def bootstrap(context,+ settings_path=None,+ database_path=None,+ address='localhost',+ port=8000,+ browser=False,+ start_server=True):'''Performs all steps necessary to bootstrap the application'''@@ -99,15 +110,14 @@ def bootstrap_wger(context,create_or_reset_admin(context, settings_path=settings_path)# Download JS libraries with bower- os.chdir(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'wger'))- context.run('npm install bower')os.chdir(os.path.dirname(os.path.abspath(__file__)))+ context.run('npm install bower')call_command('bower', 'install')# Start the webserverif start_server:print('*** Bootstraping complete, starting application')- start_wger(address=address, port=port, browser=browser, settings_path=settings_path)+ start(context, address=address, port=port, browser=browser, settings_path=settings_path)@task(help={'settings-path': 'Path to settings file (absolute path recommended). Leave empty for default',@@ -135,7 +145,7 @@ def create_settings(context, settings_path=None, database_path=None, url=None, durl = 'http://localhost:8000'# Fill in the config file template- settings_template = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'wger', 'settings.tpl')+ settings_template = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'settings.tpl')with open(settings_template, 'r') as settings_file:settings_content = settings_file.read()@@ -198,11 +208,9 @@ def create_or_reset_admin(context, settings_path=None):except User.DoesNotExist:print("*** Created default admin user")- # os.chdir(os.path.dirname(inspect.stack()[0][1]))- # current_dir = os.path.join(os.getcwd(), 'wger')current_dir = os.path.dirname(os.path.abspath(__file__))+ path = os.path.join(current_dir, 'core', 'fixtures/')- path = os.path.join(current_dir, 'wger', 'core', 'fixtures/')call_command("loaddata", path + "users.json")@@ -228,16 +236,14 @@ def load_fixtures(context, settings_path=None):setup_django_environment(settings_path)- # os.chdir(os.path.dirname(inspect.stack()[0][1]))- # current_dir = os.path.join(os.getcwd(), 'wger')current_dir = os.path.dirname(os.path.abspath(__file__))# Gym- path = os.path.join(current_dir, 'wger', 'gym', 'fixtures/')+ path = os.path.join(current_dir, 'gym', 'fixtures/')call_command("loaddata", path + "gym.json")# Core- path = os.path.join(current_dir, 'wger', 'core', 'fixtures/')+ path = os.path.join(current_dir, 'core', 'fixtures/')call_command("loaddata", path + "languages.json")call_command("loaddata", path + "groups.json")call_command("loaddata", path + "users.json")@@ -247,7 +253,7 @@ def load_fixtures(context, settings_path=None):call_command("loaddata", path + "setting_weight_units.json")# Config- path = os.path.join(current_dir, 'wger', 'config', 'fixtures/')+ path = os.path.join(current_dir, 'config', 'fixtures/')call_command("loaddata", path + "language_config.json")call_command("loaddata", path + "gym_config.json")@@ -255,20 +261,20 @@ def load_fixtures(context, settings_path=None):# path = os.path.join(current_dir, 'manager', 'fixtures/')# Exercises- path = os.path.join(current_dir, 'wger', 'exercises', 'fixtures/')+ path = os.path.join(current_dir, 'exercises', 'fixtures/')call_command("loaddata", path + "equipment.json")call_command("loaddata", path + "muscles.json")call_command("loaddata", path + "categories.json")call_command("loaddata", path + "exercises.json")# Nutrition- path = os.path.join(current_dir, 'wger', 'nutrition', 'fixtures/')+ path = os.path.join(current_dir, 'nutrition', 'fixtures/')call_command("loaddata", path + "ingredients.json")call_command("loaddata", path + "weight_units.json")call_command("loaddata", path + "ingredient_units.json")# Gym- path = os.path.join(current_dir, 'wger', 'gym', 'fixtures/')+ path = os.path.join(current_dir, 'gym', 'fixtures/')call_command("loaddata", path + "gym.json")call_command("loaddata", path + "gym-config.json")call_command("loaddata", path + "gym-adminconfig.json")