This is an application that allows the user to track their favorite things
-
check that python3 is installed
python3 -V
-
Install Postgres database
-
Clone this project
git clone https://github.com/kenware/favorite-things.git
-
Enter project root directory
cd apifavorite-things -
install virtual env in your terminal at the project root
pip3 install virtualenv
-
create virtualenv
virtualenv env
-
In the root directory, open
env/bin/activatefile and add the environmental variable at the bottom of theactivatefile accordingto the sample bellow:export DATABASE_URL=<database_url> export SECRETE=<your secrete key>
-
Inside the
deactivateblock of code in theenv/bin/activatefile add:unset DATABASE_URL unset SECRETE
-
Activate virtualenv
source env/bin/activate -
Install packages
pip3 install -r requirements.txt
-
Run test
python3 manage.py test -
Migrate tables to postgres database
python3 manage.py migrate
-
Start the application
python3 manage.py runserver
- in the root of the project
cd client - check that Nodejs or npm is installed
node -V
- Install dependency
npm install
- Start development server
npm run serve
- This project follows Pep8 style guide.
- You can enable pylint on your code editor for python
- Es-lint for javascript with air-bnb style guide
- To auto fix javascript linting errors, run
cd favorite_app/client npm run lint - To show linting error in python, run this command
pylint --load-plugins pylint_django favorite_app/
- To auto fix all linting errors in django, run
autopep8 --in-place --aggressive --aggressive favorite_app/*.py
- This API is fully documented using openApi. The schema file if found in the root directory of this project named
openapi-shema.yml - To generate a new schema, run the command below
./manage.py generateschema > openapi-schema.yml
- The deployment sript for this project is found in the root directory with a file named
deployment_script.sh. - Ensure you have setup AWS account and have launched an instance in the ubuntu machine with security groups, vpc etc.
- ssh into the instance and run the following commands
git clone https://github.com/kenware/favorite-things.git chmod +x deployment_script.sh bash deployment_script.sh