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 virtualenv
on command prompt. - Run
pip install virtualenvwrapper-win
for Windows. - Run
set WORKON_HOME=%USERPROFILES%\Envs
for Windows.
- Run
git clone
this repository andcd
into the project root. - Run
mkvirtualenv venv
for Windows orpython3 -m venv ../wc-venv
for Unix/Mac. - Run
workon venv
for Windows orsource ../wc-venv/bin/activate
for Unix/Mac. - Run
pip install -r requirements.txt
. - Run
createdb <weconnect_db>
andcreatedb <test_weconnect_db>
on the psql bash terminal. - Run
touch .env
to create a file for storing environment variables. Add the following lines (useset
for 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 .env
to activate the environment variables on Unix/Mac. - Run
env
to verify the above. - Run the migrations:
python manage.py db init
to create a migration repository.python manage.py db migrate
to update the migration script.python manage.py db upgrade
to apply the migration to the database.
- Run
python manage.py runserver
orpython3 run.py
to 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
.env
file 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 test
orpytest
.
Go to WeConnect
For detailed instructions on heroku deployments, go here or here
- Run
find . | grep -E "(\__pycache__|\migrations|\.pytest_cache)" | xargs rm -rf
to remove unnecessary files.