Skip to content

bohdan-onsha/EPAM-Python-2020-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EPAM-Python-2020-Project

Build Status Coverage Status

Description

EmployeeManagement - simple tool for managing Employees and their Departments using GUI or RESTful API.

Installation

Prerequisites

Make sure you have installed all of the following prerequisites on your development machine:

  • Python 3.6+ (with setuptools, wheel and virtualenv packages)

Install and configure MySQL:

  • Install mysql client and required packages:
sudo apt update 
sudo apt-get install python3.6-dev -y 
sudo apt-get install libsqlclient-dev -y 
sudo apt-get install libmysqlclient-dev -y 
sudo apt-get install libssl-dev -y 
sudo apt-get install mysql-client -y 
  • Install mysql server:
sudo apt install mysql-server -y  
  • Create mysql user:
sudo mysql -e "CREATE USER 'djangouser'@'localhost' IDENTIFIED BY 'password';" 
  • Grant all privileges on database to the user:
sudo mysql -e "GRANT ALL PRIVILEGES ON * . * TO 'djangouser'@'localhost';" 

Set up project:

  • Clone repository:
git clone https://github.com/OnshaBogdan/EPAM-Python-2020-Project  
  • Move into project root folder:
cd EPAM-Python-2020-Project/ 
  • Create virtual environment:
virtualenv -p python .venv  
  • Activate virtual environment:
. .venv/bin/activate  
  • Move into django project:
cd employee_management/  
  • Install dependencies:
python -m pip install -r requirements.txt  
  • Prepare database:
python manage.py makemigrations
python manage.py migrate  
  • Set environment variables:
export DB_USER=djangouser  
export DB_NAME=employee_management  
export DB_PASSWORD=password  
export SECRET_KEY=YOUR_SECRET_KEY  
  • Prepare static files:
python manage.py collectstatic
  • [Optional] Create superuser:
python manage.py createsuperuser

Run

  • Development server:
python manage.py runserver 80

Web app will be available locally here.

  • Production server:
gunicorn employee_management.wsgi --bind 0.0.0.0:80

Web app will be available:

  • Locally - http://127.0.0.1/
  • Globally - http://{PUBLIC_IP}/ (you must have proper inbound rules set).

API root can be accessed at /api subdirectory.

Tests:

To check tests, run:

python manage.py test  

All tests are stored in department_app/tests.py

Code Coverage

To check code coverage, run:

coverage erase  
coverage run  
coverage report  

You can edit coverage settings in .coveragerc

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages