-
Why
This is a proof of concept (POC) project to show a light-weight version of our competition booking platform. The aim is the keep things as light as possible, and use feedback from the users to iterate.
-
Getting Started
This project uses the following technologies:
-
Python v3.x+
-
Whereas Django does a lot of things for us out of the box, Flask allows us to add only what we need.
-
This ensures you'll be able to install the correct packages without interfering with Python on your machine.
Before you begin, please ensure you have this installed globally.
-
-
Installation
-
After cloning, change into the directory and type
virtualenv .
. This will then set up a a virtual python environment within that directory. -
Next, type
source bin/activate
(if you are on MacOS or Linux) orScripts/activate
(if you are on Windows). You should see that your command prompt has changed to the name of the folder. This means that you can install packages in here without affecting affecting files outside. To deactivate, typedeactivate
regardless of your OS. -
Rather than hunting around for the packages you need, you can install in one step. Type
pip install -r requirements.txt
. This will install all the packages listed in the respective file. If you install a package, make sure others know by updating the requirements.txt file. An easy way to do this ispip freeze > requirements.txt
-
Flask requires that you set an environmental variable to the python file. However you do that, you'll want to set the file to be
server.py
. Check here for more details -
You should now be ready to test the application. In the directory, type either
flask run
orpython -m flask run
. The app should respond with an address you should be able to go to using your browser.
-
-
Current Setup
The app is powered by JSON files. This is to get around having a DB until we actually need one. The main ones are:
- competitions.json - list of competitions
- clubs.json - list of clubs with relevant information. You can look here to see what email addresses the app will accept for login.
-
Testing
Please find below a list of commands you can run using the implemented test suite:
- Launching all the tests : Go to the root folder and type the following command :
pytest tests/
orpytest tests/ -vv
should you wish to have more details about the tests. - Checking the test coverage : Go to the root folder and type the following command :
pytest --cov=. tests/
- Launching a performance test :
- Go to the following folder :
oc-cg-p11/tests/performance_tests/
and type the following command :locust
- On your browser, go to the following link :
http://localhost:8089/
- Populate the fields with the following informations:
The host field should correspond to the address on which the application is running, please amend if yours is different.
Number of users : 1 Spawn Rate : 1 Host : http://127.0.0.1:5000/
- Click on the
Start swarming
button. - Important reminder 1 : You have to have the application running in another terminal. Otherwise, the test won't work.
- Important reminder 2 : Hit the stop button before leaving the Locust page.
- Go to the following folder :
- Launching all the tests : Go to the root folder and type the following command :
forked from OpenClassrooms-Student-Center/Python_Testing
-
Notifications
You must be signed in to change notification settings - Fork 0
CeeG33/oc-cg-p11
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Projet n°11 - Améliorez une application Web Python par des tests et du débogage
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Python 90.6%
- HTML 9.4%