|
1 | 1 | # Programming Buddies API |
2 | | -API backend for Programming Buddies (projects management) |
3 | 2 |
|
4 | | -## Tech Stack |
5 | | -- Python 3.7 |
6 | | -- Flask |
7 | | -- MySql |
8 | | -- pyOpenSSL |
| 3 | +API backend for [Programming Buddies](https://github.com/ProgrammingBuddies/programmingbuddies-ui) (projects management) |
9 | 4 |
|
10 | | -## Set up guide |
11 | | -- Download and install MySQL Community Server from `https://dev.mysql.com/downloads/mysql/` |
12 | | -- `git clone https://github.com/ProgrammingBuddies/programmingbuddies-api.git` |
| 5 | +## Set up guide: The simple way |
13 | 6 |
|
14 | | -### The simple way |
| 7 | +- Set up your [environment](#environment) |
| 8 | +- Install [docker-compose](https://docs.docker.com/compose/install/) and do `docker-compose up` |
15 | 9 |
|
16 | | -Install docker-compose and do `docker-compose up`. Don't forget to setup your |
17 | | -.env file. |
| 10 | +## Set up guide: The 'bothersome' way |
18 | 11 |
|
19 | | -### Pipenv |
20 | | -- run `python -m pip install pipenv` to install pipenv |
21 | | -- run `pipenv install` inside the repository |
22 | | -- - if you have multiple Python versions installed you might need to specify which one to use `pipenv install --python=python3.7` |
| 12 | +Requirements: |
23 | 13 |
|
24 | | -### SSL |
25 | | -- On Mac or linux install the openssl tool and run `openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365` inside the repository |
26 | | -- On windows ... explanation will follow. |
| 14 | +- Set up your [environment](#environment) |
| 15 | +- [MySQL Community Server](`https://dev.mysql.com/downloads/mysql/`) |
| 16 | + - Add line `CONNECT=mysql+pymysql://<user>:<password>@localhost:3306/<database name>` to your [`.env` file](#environment) to specify connection parameters |
| 17 | +- Pipenv |
| 18 | + 1. Run `python -m pip install pipenv` to install pipenv |
| 19 | + 2. Run `pipenv install` inside the repository |
| 20 | + - If you have multiple Python versions installed you might need to specify which one to use `pipenv install --python=python3.7` |
| 21 | +- SSL |
| 22 | + 1. On Mac or Linux install the openssl tool and run `openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365` inside the repository |
| 23 | + 2. On Windows ... explanation will follow. |
27 | 24 |
|
28 | | -### Environment |
29 | | -- create a file `.env` |
30 | | -- - `.env` in this case is the full filename and not just the extension. `app.env` for example would not be loaded automatically by pipenv |
31 | | -- - add line `FLASK_ENV=development` to have the server automatically restart on file changes |
32 | | -- - add line `CONNECT=mysql+pymysql://<user>:<password>@localhost:3306/<database name>` to specify connection parameters |
| 25 | +Run the server: |
33 | 26 | - `pipenv run python src/runserver.py` |
34 | | -- - run with flag `--reset-db` to recreate all tables on start |
35 | | -- add line `APP_SECRET=somepassword` as app secret. This is used to sign sessions among other things and is required |
36 | | -- Optain credentials for Github |
37 | | -- - Under your github account Settings go to Developer Settings and OAuth Apps |
38 | | -- - create a new one and set the homepage url to `https://localhost:5001/` and Authorization callback to `https://localhost:5001/login/github/authorized` |
39 | | -- - Copy the Client Id and Client Secret from that site and save them in `.env`as `GITHUB_ID` and `GITHUB_SECRET` respectively |
| 27 | + - Run with flag `--reset-db` to drop and recreate all tables on start |
| 28 | + |
| 29 | +## Environment |
| 30 | + |
| 31 | +1. Create a file named `.env` |
| 32 | + - Add line `FLASK_ENV=development` to have the server automatically restart on file changes |
| 33 | +2. Add line `APP_SECRET=somepassword` as app secret. This is used to sign sessions among other things and is required |
| 34 | +3. Obtain credentials for GitHub OAuth |
| 35 | + - Under your GitHub account Settings go to Developer settings and OAuth Apps |
| 36 | + - Create a new one and set the homepage url to `https://localhost:5001/` and Authorization callback to `https://localhost:5001/login/github/authorized` |
| 37 | + - Copy the Client Id and Client Secret from that site and save them in `.env` as `GITHUB_ID` and `GITHUB_SECRET` respectively |
40 | 38 |
|
41 | 39 | Your `.env` file should now look something like [example.env](https://github.com/ProgrammingBuddies/programmingbuddies-api/blob/develop/example.env) |
42 | 40 |
|
43 | | -## Milestones |
44 | | -- [ ] build DB and endpoints with basic CRUD |
45 | | -- [ ] add security for app (ie - bots, and non-human actors/clients) |
46 | | -- [ ] add users and profile stores as well as registration/management API endpoints for users |
| 41 | +## Tech stack: |
| 42 | + |
| 43 | +- Python |
| 44 | +- Flask |
| 45 | +- MySQL |
| 46 | +- pyOpenSSL |
0 commit comments