... | ... | @@ -2,36 +2,21 @@ Note: the application is considered to be installed in the STOCK_MANAGER_PATH di |
|
|
|
|
|
# Requirements
|
|
|
|
|
|
In order to create the virtual environment, you need python 3 installed. This wiki page is done using the following version: `Python 3.5.2`.
|
|
|
|
|
|
The following packages must be installed:
|
|
|
* python3-venv
|
|
|
* make
|
|
|
* gettext
|
|
|
|
|
|
|
|
|
# Virtual Environment
|
|
|
|
|
|
To create the virtual environment, you need to execute the following command:
|
|
|
```bash
|
|
|
python3 -m venv venv
|
|
|
```
|
|
|
|
|
|
In order to activate your virtual environment, you need to execute the following command:
|
|
|
```bash
|
|
|
source venv/bin/activate
|
|
|
```
|
|
|
In order to execute the other commands, you will need your virtual environment activated.
|
|
|
|
|
|
To execute the virtual environment:
|
|
|
```bash
|
|
|
deactivate
|
|
|
```
|
|
|
|
|
|
If you want to install requirements, execute the following command:
|
|
|
```bash
|
|
|
pip install --upgrade --requirement requirements.txt
|
|
|
```
|
|
|
XXX is the default account that installs the software
|
|
|
* Install apache2 : sudo apt install apache2
|
|
|
* Install mod-wsgi : sudo apt install libapache2-mod-wsgi-py3
|
|
|
* Active mod-wsgi : cd /etc/apache2/mods-enabled; sudo ln-s ../mods-available/wsgi* .
|
|
|
* Install gettext : sudo apt install gettext
|
|
|
* Install pip : sudo apt install python3-pip
|
|
|
* To avoid pip conflicts : export PATH="${HOME}/.local/bin:$PATH"
|
|
|
* Install pipenv : pip3 install pipenv
|
|
|
* Create group : sudo groupadd stock
|
|
|
* Add user (XXX/www-data) : sudo usermod -a -G stock XXX
|
|
|
* Clone good branch in /opt : sudo git clone -b pre-prod https://gitlab.insa-rouen.fr/delestre/pao-stock-manager.git
|
|
|
* Change owner : sudo chown -R XXX.stock /opt/pao-stock-manager
|
|
|
* Add write permission for stock group : sudo chmod -R g+w /opt/pao-stock-manager
|
|
|
* Indicate to create virtual env in local : export PIPENV_VENV_IN_PROJECT="true"
|
|
|
* Configure the environment : pipenv install
|
|
|
|
|
|
|
|
|
# Setup the Django application
|
... | ... | @@ -111,25 +96,6 @@ To run your server, you can use this command: |
|
|
make run
|
|
|
```
|
|
|
|
|
|
# Production or pre pduction (on linux). XXX is the default account that installs the software
|
|
|
* Install apache2 : sudo apt install apache2
|
|
|
* Install mod-wsgi : sudo apt install libapache2-mod-wsgi-py3
|
|
|
* Active mod-wsgi : cd /etc/apache2/mods-enabled; sudo ln-s ../mods-available/wsgi* .
|
|
|
* Install gettext : sudo apt install gettext
|
|
|
* Install pip : sudo apt install python3-pip
|
|
|
* To avoid pip conflicts : export PATH="${HOME}/.local/bin:$PATH"
|
|
|
* Install pipenv : pip3 install pipenv
|
|
|
* Create group : sudo groupadd stock
|
|
|
* Add user (XXX/www-data) : sudo usermod -a -G stock XXX
|
|
|
* Clone good branch in /opt : sudo git clone -b pre-prod https://gitlab.insa-rouen.fr/delestre/pao-stock-manager.git
|
|
|
* Change owner : sudo chown -R XXX.stock /opt/pao-stock-manager
|
|
|
* Add write permission for stock group : sudo chmod -R g+w /opt/pao-stock-manager
|
|
|
* Indicate to create virtual env in local : export PIPENV_VENV_IN_PROJECT="true"
|
|
|
* Configure the environment : pipenv install
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Apache configuration
|
|
|
The apache module libapache2-mod-wsgi-py3 must be installed.
|
|
|
|
... | ... | @@ -141,11 +107,11 @@ cd /etc/apache2 |
|
|
cat sites-available/000-stock-manager.conf
|
|
|
|
|
|
WSGIScriptAlias / /opt/pao-stock-manager/conf/wsgi.py
|
|
|
WSGIPythonHome /opt/pao-stock-manager/venv
|
|
|
WSGIPythonHome /opt/pao-stock-manager/.venv
|
|
|
WSGIPythonPath /opt/pao-stock-manager
|
|
|
|
|
|
<VirtualHost *:80>
|
|
|
Alias /static/admin/ /opt/pao-stock-manager/venv/lib/python3.6/site-packages/django/contrib/admin/static/admin/
|
|
|
Alias /static/admin/ /opt/pao-stock-manager/.venv/lib/python3.6/site-packages/django/contrib/admin/static/admin/
|
|
|
Alias /static/ /opt/pao-stock-manager/stock/static/
|
|
|
|
|
|
<Directory /opt/pao-stock-manager>
|
... | ... | @@ -158,7 +124,7 @@ WSGIPythonPath /opt/pao-stock-manager |
|
|
Require all granted
|
|
|
</Directory>
|
|
|
|
|
|
<Directory /opt/pao-stock-manager/venv/lib/python3.6/site-packages/django/contrib/admin/static/admin>
|
|
|
<Directory /opt/pao-stock-manager/.venv/lib/python3.6/site-packages/django/contrib/admin/static/admin>
|
|
|
Require all granted
|
|
|
</Directory>
|
|
|
</VirtualHost>
|
... | ... | |