SCHOOL PORTAL
This project is meant to Create a school portal with oython flask.
TOOLS TO BE USED IN THE DEVELOPMENT
- Server-Side Framework: Flask Python Framework
- Linting Library: Pylint, a Python Linting Library
- Style Guide: PEP8 Style Guide
- Testing Framework: PyTest, a Python Testing Framework
- Testing Framework: Coverage, a Python Testing Framework
REQUIREMENTS
This are the basic project requirements. Make sure to install the before attempting to run the project.
1. Python: [Install Python3](https://realpython.com/installing-python/)
2. Postgres: [Install Postgres](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-18-04)
3. Git: [Install Git](https://www.digitalocean.com/community/tutorials/how-to-install-git-on-ubuntu-18-04)
4. Node: [Install Node](https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04)
5. Postman: [Install Postman](https://linuxize.com/post/how-to-install-postman-on-ubuntu-18-04/)
The others can be downloaded and install from the requirements file. The installation process is outlined in the section How to run the application.
HOW TO RUN THE APPLICATION
Note that this project is meant for linux.
-
Make a new directory on your computer and name it
portalor give it any name of your choice. -
Navigate to the directory you have created and open it in the terminal.
-
On the terminal type
git cloneand add this linkrepoand the pressenterto clone the remote repository to your local repository i.egit clone 'link'. Add the link without the quotation. -
Navigate to the directory that has been cloned to your machine and open it in a terminal.
-
Create virtual environment by typing this in the terminal
virtualenv -p python3 venv. -
Run
pip install -r requirements.txton the terminal to install the dependencies. -
Create
.envfile, copy the following environment variables and provide all the necessary information.source venv/bin/activate export FLASK_APP=run.py export FLASK_ENV=development export DEBUG_TB_INTERCEPT_REDIRECTS=False export REQUEST_STATS_WINDOW=15 # database export DB_NAME=YOUR_DATABASE_NAME export TEST_DB_NAME=YOUR_TEST_DATABASE_NAME export DB_USER=YOUR_DATABASE_USERNAME export DB_HOST=YOUR_DATABASE_HOST export DB_PASSWORD=YOUR_DATABASE_PASSWORD # SQLALCHEMY export DATABASE_URL=YOUR_DATABASE_URI export TEST_DATABASE_URL=YOUR_TEST_DATABASE_URI export SQLALCHEMY_TRACK_MODIFICATIONS=False # brokers export LOCAL_RABBITMQ_URL=amqps://localhost// export RABBITMQ_URL=YOUR_HOSTED_RABBITQ_URL export LOCAL_REDISTOGO_URL=redis:// export REDISTOGO_URL=YOUR_HOSTED_RABBITQ_URL # app secret key export SECRET_KEY=YOUR_APP_SECRET_KEY export JWT_SECRET_KEY=YOUR_JWT_SECRET_KEY # mail server export MAIL_SERVER=YOUR_MAIL_SERVER export MAIL_PORT=YOUR_MAIL_PORT export MAIL_USERNAME=YOUR_EMAIL export MAIL_PASSWORD=YOUR_EMAIL_PASSWORD export MAIL_USE_TLS=False export MAIL_USE_SSL=True -
Then type on the terminal
source .envto activate the environment and also to export all the environment variables. -
Then type on the terminal
python3 manage.py runserverto start and run the server.
HOW TO RUN TESTS
- Open a new terminal and then activate the environment.
- Type
python3 manage.py pytestto run tests. This will run all tests and then give you a Coverage with details.
OTHER IMPORTANT LINKS
AUTHOR
Harun Gachanja Gitundu.