Skip to content

Django API to handle users for company Okoone and let them add / remove their favorite artists in some notes

Notifications You must be signed in to change notification settings

ArnaudNorel95/Okoone_user_management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Authors

  • Arnaud Norel

Prerequisites

if you use vscode:

Installation if you want to use a postgres db

  1. Create a postgres user by following this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04
    • Windows only: you should run psql -U postgres instead of sudo -u postgres psql
    • Credentials used for this project are :
    • db_name : sample_db
    • db_user : arno
    • password : EmployeeManagement
    • already detailed in docker-compose.yml
  2. clone the repo: https://github.com/ArnaudNorel95/Okoone_user_management.git
  3. Open the repo with command line and create a venv: python3.8 -m venv env
  4. Activate the venv:
    • Linux: source env/bin/activate
    • Windows CMD: env\Scripts\activate.bat,
    • Windows PS: env\Scripts\activate.ps1
  5. (make sure your pip is linked with the venv): pip --version, you whould see something like: .../core/env/lib/site-packages/pip (python 3.8)
    • Update pip: python -m pip install --upgrade pip
  6. Install requirements.txt: pip install -r requirements.txt
  7. Open the folder with VSCode (or your prefeered text editor): code .
  8. Open control palette (Ctrl+Shift+P) and select Python: Select Interpreter
  9. Choose the venv python interpreter (it should be recommanded one)
  10. Close the command line inside VSCode (if it was open) and open a new one using Ctrl+J. You should see the venv name in the command line

CONNECT THE APPLICATION TO SAMPLE DB

  • In core/settings.py, either you use the sample.db with all the data already ready then don't need to do the steps 11. and 12. But You need to uncomment the default database. Either you use a postgresql db then need to make the migrations (as example for running the tests)
  1. Run python manage.py makemigrations
  2. Run python manage.py migrate,
  3. Run python manage.py createsuperuser and create a Django user to access to the admin side
  4. Run python manage.py runserver and wait for the application to start

GET CUSTOMERS

  1. Open Postman, create a new environment and set the url variable to http://127.0.0.1:8000
  2. In postman, select your environment and use the GET Method at the route /api/customers
  3. If you have a response, then the local API is working successfuly !

CREATE ARTIST

  1. Still in postman, select your environment and use the POST Method at the route /api/artists/
  2. If you have a response, then the local API is working successfuly !

RUN THE SQL QUERY

  1. Please find the file SQLquery in core/ to show how much each customer had spent in the store.

Warning: if you have made modifications to /app/models.py, do not forget to run python mange.py makemigrations and python manage.py migrate BEFORE running the server

More

If you install a new python package, do not forget to add it to the requirements.txt

About

Django API to handle users for company Okoone and let them add / remove their favorite artists in some notes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages