- Clone the repository.
- Using HTTPS:
git clone https://github.com/HackRU/teamRU.git - Using SSH:
git clone git@github.com:HackRU/teamRU.git
- Using HTTPS:
- Enter the
teamRUdirectory.cd teamRU
- Create a file called
config.pyinside of/src/flaskapp/folder. - Copy the contents of
config.example.pyintoconfig.py. - Install the required dependencies.
pip3 install -r requirements.txt
- Set environment variables (replace
exportwithsetif you are developing on windows).export FLASK_APP=src/flaskapp/api.pyexport FLASK_ENV=development
- Start TeamRU using Flask.
flask run
- Follow the steps here to install MongoDB for your respective OS.
- Run
mongo --version. If you have installed MongoDB correctly, then the output of this command will be your current mongo version. - There are two mains ways of interfacing with MongoDB:
- CLI (terminal)
- MongoDB Compass (Desktop App)
We personally recommend MongoDB Compass for beginners
Run the following commands inside of your computer's terminal
mongouse <name_of_database>(this will be the name of your new mongo database)db.teams.insertOne({})(insert a collection called teams which will hold our teams info)db.users.insertOne({})(insert a collection called users which will hold our users info)- Insert
mongodb://127.0.0.1:27017/<name_of_database>in theDB_URIfield inside ofconfig.py.
- Download MongoDB Compass from here.
- Click
Connect- hostname: localhost and port: 27010 - Click
Create Database- Database Name:
<name_of_database> - Collection Name:
teams - Click
Create Database
- Database Name:
- Click on your database in the list
- Click
Create Collection- Collection Name:
users
- Collection Name:
- Insert
mongodb://127.0.0.1:27017/<name_of_database>in theDB_URIfield inside ofconfig.py.
In the long term, we want to make sure that code is properly styled and commented to make it easier for developers to maintain and enhance.
To achieve this on our current codebase, we will use a combination of pylint and black.
- Useful for identifying issues such as import order, naming conventions, missing docstrings, etc.
- Doesn't actually make any changes, but provides a list of suggestions that can be made to improve the code
- All pylint codes can be found here
- Aggressive but useful for creating standardized code styling
- Automatically fixes issues such as files ending without newlines, single quotes instead of double quotes, trailing whitespace, etc.
In these instances where we feel like ignoring pylint warnings, or where pylint and black disagree, we will suppress pylint. These issues will be handled on a case-by-case basis.
In general, Google's Python Style Guide is a great resource. Specifically, we will be using their guidelines on comments and docstrings to document our code. Again, this isn't set in stone - any disagreement with the styling conventions can be handled on a case-by-case basis.
In general, the developer workflow should look a little like this:
write code
run pylint
while pylint raises warnings:
for warning in warnings:
if warning is important:
fix it
else:
suppress it
run pylint
run black
push code