Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
/ sepp Public archive

Software Engineering & Professional Practice project

Notifications You must be signed in to change notification settings

Javrd/sepp

Repository files navigation

Table of contents

Develop environment

We use here python and pip, but if you have python 2 installed in your system you may change them for python3 and pip3.

Installing development enviroment

Ubuntu

Instal dependencies:

sudo apt install -y python3 python3-pip mysql-server libmysqlclient-dev

You could also want to install mysql-workbench, so you can inspect database with an UI.

sudo apt install -y  mysql-workbench

Windows

Install python. Ensure you select "Add Python 3.6 to PATH" before selecting "Install Now" or "Customize installation". If you choose customize installation, you should select at least pip.

Install mysql-server. You could not want to install all the package. You need at least MySQL 5.7 and you could also want to install MySQL Workbench, so you can inspect database with an UI.

Installing redis

As we use redis for the channel layer of websockets, we need this service working on the correct port. To use it we have two options. We only use websocket for the chat feature, so if you don't run this service the only feature affected is the chat.

Option 1: Docker

The easier way. With docker installed, just run this command to get redis working:

docker run -p 6379:6379 -d redis:2.8

Option 2: Bare metal

Ubuntu

If you want install it in a linux enviroment, use those commands:

wget http://download.redis.io/releases/redis-2.8.24.tar.gz
tar xzf redis-2.8.24.tar.gz
cd redis-2.8.24
make

You can use redis now using this command in the same folder:

src/redis-server

Windows

If you want to use redis on windows you should install the non official port. You can download the installer here. Make sure you select add to the path when installing it.

To run the service, open a terminal and execute:

redis-server --maxheap 150M

Then go to your repository folder and execute:

pip install pypiwin32

Installing python dependencies

Open a terminal at repository folder:

pip install -r requirements.txt

Creating the database

mysql -u root -p < create_db.sql

You should input your mysql root password.

You could also open and run this scipt from mysql-workbench.

Populating database

Once database is created, you can generate tables for our model with this command:

python manage.py migrate

You also can populate it with some testing information with:

python populate.py

Runing the server

Use this command to mount localhost server. You can access at port 8000.

python manage.py runserver

Running automated tests

Some test cases can be automated. In order to run all our test use this command:

python manage.py test mvp.test

Pre-production-environment

We are using docker so deployed system should work in the same way as it does in local. The system has two services, the django web service and the database. We use a docker compose file with the mariadb image for the database and a dokerfile that we build for django. This dockerfile use an ubuntu image and install apache on it with mod_wsgi in order to deploy django system.

It's important change some settings of django in a production environment, so we use environment variables in docker compose to define those settings.

Production-environment

The deployed system is at http://artinbar.es

About

Software Engineering & Professional Practice project

Resources

Stars

Watchers

Forks

Packages

No packages published