STEM Diverse TV is a project which gather and provide inspiring, motivating, informative, educational and supportive videos about diversity in STEM. This is the backend of the project. Documentation of the project is hosted here
- Languages: Python 3.x, Javascript (Docusaurus)
- Framework: Flask 1.1.2
- Flask Extensions: Flask-RESTX 0.3.0 , Flask-SQLAlchemy 2.5.1, Flask-JWT-Extended 4.1.0
- Hosting Service: Heroku
- Database: PostgreSQL 13.2
To setup the project locally follow the instructions:
Please make a virtual environment and run the following commands.
virtualenv venv --python=python3
source ./venv/bin/activate
pip3 install -r requirements.txt
- Please download Firebase Admin SDK service json file from Firebase Console, You can download the file by following below steps:
- Go to
Project Settings/Service accounts
- Click on
Generate New Primary Key
- Place the file in project's root directory and rename it to
google-credentials.json
- Go to
- Make .env file from given .env.template file and add details like API_KEY, which is a web api key from firebase. Find your project's web api key in project's overview tab on firebase console.
Use .env.template file to make a new .env file and add the following details:
API_KEY=<firebase-project-web-api-key>
EMAIL_USER=<Email-Address>
EMAIL_PASS=<Password>
After this, execute:
python run.py
or
python3 run.py
Database setup:
- if you take a look into
.env.template
you will see that there are multiple config environments (the easiest for the use is local, no database setup) - for the ones where the database is necessary, you will need to provide the DB details in the
.env
file
PostgreSQL is the database that we are going to use in the deployed version. Here is the script that will help you create the Postgres user and and database. Of course. you need to have PostgreSQL installed on your local machine.
# CREATEDB for the privilege to create it's own DB
CREATE USER <stem_diverse> WITH PASSWORD 'examplepassword' CREATEDB;
CREATE DATABASE <database_name> WITH OWNER <stem_diverse> ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';
Note: This is only needed if you want to contribute to the project.
If you want to contribute to the project you will have to create your own copy of the project on GitHub. You can do this by clicking the Fork button that can be found on the top right corner of the landing page of the repository.
Note: For this you need to install git on your machine. You can download the git tool from here.
-
If you have forked the project, run the following command -
git clone https://github.com/YOUR_GITHUB_USER_NAME/stem-diverse-tv
where
YOUR_GITHUB_USER_NAME
is your GitHub handle. -
If you haven't forked the project, run the following command -
git clone https://github.com/anitab-org/stem-diverse-tv
-
Now after you cloned the repository, move to stem-diverse-tv directory by -
cd stem-diverse-tv
Note: This is only needed if you want to contribute to the project.
When a repository is cloned, it has a default remote named origin
that points to your fork on GitHub, not the original repository it was forked from. To keep track of the original repository, you should add another remote named upstream. For this project it can be done by running the following command -
git remote add upstream https://github.com/anitab-org/stem-diverse-tv
You can check that the previous command worked by running git remote -v
. You should see the following output:
$ git remote -v
origin https://github.com/YOUR_GITHUB_USER_NAME/stem-diverse-tv (fetch)
origin https://github.com/YOUR_GITHUB_USER_NAME/stem-diverse-tv (push)
upstream https://github.com/anitab-org/stem-diverse-tv (fetch)
upstream https://github.com/anitab-org/stem-diverse-tv (push)
To run the unitests run the following command in the terminal (while the virtual environment is activated):
python -m unittest discover tests
We use Black to format code automatically so that we don't have to worry about clean and readable code. To install Black:
pip install black
To run black:
black .
Steps
-
You need a Google Account to access the Google API Console, request an API key, and register your application.
-
Create a project in the Google Developers Console and obtain authorization credentials so your application can submit API requests.
-
After creating your project, make sure the YouTube Data API is one of the services that your application is registered to use:
- Go to the API Console and select the project that you just registered.
- Visit the Enabled APIs page. In the list of APIs, make sure the status is ON for the YouTube Data API v3
This project is under active development
Please read our Contributing Guidelines, Code of Conduct and Reporting Guidelines thoroughly.
Thanks goes to these people (emoji key):
Anna Bauza 💻 🚧 |
This project follows the all-contributors specification. Contributions of any kind welcome!
If you have any questions or want to discuss something about this repo, feel free to reach out to our team on our Zulip channel #Design-team. If you are a new contributor, head over to this project's stream (https://anitab-org.zulipchat.com/#narrow/stream/225705-STEM-diverse-tv) on Zulip to see ongoing discussions.
The project is licensed under the GNU General Public License v3.0. Learn more about it in the LICENSE file.