Skip to content

Latest commit

 

History

History
92 lines (66 loc) · 2.67 KB

README.md

File metadata and controls

92 lines (66 loc) · 2.67 KB

Internship Tracker Server (Backend)

This project utilizes Flask

📙 Pre-requisites

Follow the steps 1-5 here to install Python3.

⚡ Quick Start

Create and activate the virtual environment

cd server
python3 -m venv venv
source venv/bin/activate

Install Python packages using pip

pip install -r requirements.txt

Add the line below to the .flaskenv file if you would like to enable DEBUG mode

FLASK_DEBUG=1

In your .env file add. Note: If you don't have Postgres installed locally, see Working With Docker.

# dialect and driver are postgresql and psycopg2 respectively
POSTGRES_URI=dialect+driver://username:password@host:port/database

# add this environment variable when running tests
TEST_URI=dialect+driver://username:password@host:port/database

Run the server!

flask --app webserver run

Working With Docker

First make sure you have Docker installed.

Database Only:

If you are working on the webserver locally and only need spin up a database you can run:

docker run --name "The name for the container" \
-e POSTGRES_USER="a username for the database" \
-e POSTGRES_PASSWORD="some password" \
-e POSTGRES_DB="some database name" \
-p 5432:5432 \
-d postgres

then use all of the above to create your POSTGRES_URI environment variable.

Webserver

If you want to run the webserver with Docker or are working on the client side and need to test interactions with the web server you will need to set up a few environment variables to get things running.

In your .env file make sure you have:

POSTGRES_PASSWORD=somepassword #change this
POSTGRES_DB=someDBname #change this
POSTGRES_USER=someuser #change this
POSTGRES_URI=postgresql+psycopg2://POSTGRES_USER:POSTGRES_PASSWORD@db:PORT/POSTGRES_DB #change this with the appropriate values

After your environment variables are set, from the root directory run

docker compose up

📂 Installing New Packages

pip freeze > requirements.txt

After installing new packages, run the command above to update requirements.txt

note: Make sure you are in the virtual environment

🤝 Contributing

Here from the 🧋 BobaTalks discord? Find issues labeled for you here