WeConnect brings businesses and users together, and allows users to review businesses
- Users can create an account and log in
- Authenticated Users can register a business.
- Only the user that creates the business can update and delete a business
- Users can view businesses.
- Users can give reviews about a business.
- Users can search for businesses based on business location or business category.
| EndPoint | Functionality |
|---|---|
| POST /api/v2/auth/register | Creates a user account |
| POST /api/v2/auth/login | Logs in a user |
| POST /api/v2/auth/logout | Logs out a user |
| POST /api/v2/auth/reset-password | Password reset |
| POST /api/v2/businesses | Register a business |
| PUT /api/v2/businesses/<businessId> | Updates a business profile |
| DELETE /api/v2/businesses/<businessId> | Remove a business |
| GET /api/v2/businesses | Retrieves all businesses |
| GET /api/v2/businesses/<businessId> | Get a business |
| POST /api/v2/businesses/<businessId>/reviews | Add a review for a business by the logged in user |
| GET /api/v2/businesses/<businessId>/reviews | Get all reviews for a business |
- Install Python.
- Install PostgreSQL.
- Run
pip install virtualenvon command prompt. - Run
pip install virtualenvwrapper-winfor Windows. - Run
set WORKON_HOME=%USERPROFILES%\Envsfor Windows.
- Run
git clonethis repository andcdinto the project root. - Run
mkvirtualenv venvfor Windows orpython3 -m venv ../wc-venvfor Unix/Mac. - Run
workon venvfor Windows orsource ../wc-venv/bin/activatefor Unix/Mac. - Run
pip install -r requirements.txt. - Run
createdb <weconnect_db>andcreatedb <test_weconnect_db>on the psql bash terminal. - Run
touch .envto create a file for storing environment variables. Add the following lines (usesetfor Windows instead ofexport, used here for Unix/Mac) to it:
export DATABASE_URL=postgresql://<db_user>:<password>@localhost/<weconnect_db>
export SECRET_KEY=<some_secret_value>
export FLASK_CONFIG=development- Run
source .envto activate the environment variables on Unix/Mac. - Run
envto verify the above. - Run the migrations:
python manage.py db initto create a migration repository.python manage.py db migrateto update the migration script.python manage.py db upgradeto apply the migration to the database.
- Run
python manage.py runserverorpython3 run.pyto run on the default ip and port. - View the app on
http://127.0.0.1:5000/.
- View the api on
http://127.0.0.1:5000/api/v2/ - Test it's usage with postman
- View the api on Heroku
- View the api on
http://127.0.0.1:5000/apidocs
- Change the
.envfile to:
export DATABASE_URL=postgresql://<db_user>:<password>@localhost/<test_weconnect_db>
export SECRET_KEY=<some_secret_value>
export FLASK_CONFIG=testing- Run
source .env. - Run the migrations like before.
- Run
python manage.py testorpytest.
Go to WeConnect
For detailed instructions on heroku deployments, go here or here
- Run
find . | grep -E "(\__pycache__|\migrations|\.pytest_cache)" | xargs rm -rfto remove unnecessary files.