Skip to content

mehalyna/Ch-117-Python-Project-ITA

Repository files navigation

Ch-117-Python-Project-ITA

Python Project of Ch-117 mixed group ITA

Installation for Windows

  1. Install python 3.8 at the link
  2. Install MongoDB at the link
  3. Clone the repository
    git clone https://github.com/mehalyna/Ch-117-Python-Project-ITA.git
  4. Install python packages from requirements.txt
    pip install -r requirements.txt
  5. Initialize database
    • Install MongoDB Compass
    • Set up MongoDB Compass
      • Meke connection mongodb://<your_url>:<your_port>
      • Create database <your_db_name>
    • Create file .env in root folder of the project with fields:
       FLASK_SECRET_KEY=<your_secret_key>
       DJANGO_SECRET_KEY=<your_secret_key>
       DB_NAME=<your_db_name>
       MONGO_URL=<your_url>
       PORT=<your_port>
       EMAIL_HOST_USER=<your_app_email>
       EMAIL_HOST_PASSWORD=<your_app_email_password>
       ADMIN_EMAIL=<admin_email>
       CACHE_LIFETIME=<cache_lifetime_in_min>
       STRIPE_PUBLIC_KEY=<stripe_public_key>
       STRIPE_SECRET_KEY=<stripe_secret_key>
    

Our project include two servers:

  • admin
  • user

To run admin server:

  1. Create the first administrator user to login in admin.
  • Start flask shell from terminal:
  • from models import MongoUser
  •  u = MongoUser(firstname='<UserFirstname>', lastname='<UserLastname>', username='<Username>', role='admin', email='<[email protected]>')
  • Minimum number of characters for login = 6
  •  u.set_password('<UserPassword>')
  • Minimum number of characters for password = 8
  •  u.save()

Following commands should be run in the 'admin' directory of the projectad

  1. Run the server
    theproject\admin>app.py
  2. Run the tests
    theproject\admin>pytest -v
  3. To see test coverage
    theproject\admin>coverage run -m --omit='*/venv/*' pytest -v
    theproject\admin>coverage report

To run user server:

Following commands should be run in the 'library' directory of the project

  1. Run the server

     theproject\library>python manage.py runserver
  2. Run the tests

     theproject\library>python manage.py test -v 2
  3. To see test coverage

    theproject\library>coverage run --omit='*/venv/*' manage.py test -v 2
    theproject\library>coverage report

For contributors

Project setup

Start with our wiki

Git Flow

We are using simpliest github flow to organize our work: Git Flow Ilustration

Note! Contribution rules:

  1. All Pull Requests should start from prefix #xxx-yyy where xxx - task number and and yyy - short description e.g. #020-CreateAdminPanel
  2. Pull request should not contain any files that is not required by task.

In case of any violations, pull request will be rejected.

About

Python Project of Ch-117 mixed group ITA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published