EmployeeManagement - simple tool for managing Employees and their Departments using GUI or RESTful API.
Make sure you have installed all of the following prerequisites on your development machine:
- Python 3.6+ (with
setuptools
,wheel
andvirtualenv
packages)
- 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';"
- 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
- 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.
To check tests, run:
python manage.py test
All tests are stored in department_app/tests.py
To check code coverage, run:
coverage erase
coverage run
coverage report
You can edit coverage settings in .coveragerc