Skip to content

Latest commit

 

History

History
113 lines (75 loc) · 2.22 KB

README.md

File metadata and controls

113 lines (75 loc) · 2.22 KB

Large Scale Infraestructure Laboratory

This is the source code of the "Lascilab" webpage, it was wrote using python3.6+.

Make a backup of the database data

Pleace make a backup of the database before perform the 'docker-compose down' command.

docker-compose exec web ./manage.py dumpdata --indent 2 index person event auth.user > backup.json

For deploy in production

Update webpage changes

git pull origin master
docker-compose restart web

Deploying a completely new version

locate in the webpage directory and perform the following commad to remove the old version.

docker-compose down --volumes --rmi all --remove-orphans

Install Docker and Docker Compose.

docker-compose build
docker-compose up -d

when the web service is ready, use the following command to load the static files for the admin page.

docker-compose exec web ./manage.py collectstatic

to load the initial data of the database use the following command.

docker-compose exec web ./manage.py loaddata db.json

For Development

Configure you machine

Assuming you're on debian like OS

sudo apt-get update
sudo apt-get install python-dev python-pip libpq-dev
sudo pip install virtualenv virtualenvwrapper requests[security]

locate in the webpage directory and perform the following commads to setup the development virtualenv.

mkvirtualenv --python=python3.6 .env

activate the development environment

source .env/bin/activate

install the app requirements.

pip3.6 install -r dev_req.txt

if the python virtual environment is active, use the following command to deactivate it.

deactivate

create data base migrations. Note: every time you change a model you have to perform "makemigrations" and "migrate" in order to apply the changes to the database.

./manage.py makemigrations

apply migrations changes into the database.

./manage.py migrate

Running the development server

to run the development server.

./manage.py runserver 0.0.0.0:8000