dann254 / company-roles-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

COMPANY ROLES - [API]

authenticate users based on role

Relevant Links

Relevant information

  • ** admins ** can only be created through the console with the following command.
python manage.py createsuperuser --email email@example.com

How to set up

  • Make sure you have python3 installed.
  • You should have postgreSQL or other database management engines installed in your development environment.
  • Install virtualenv and virtualenvwrapper or use suitable alternatives to create a virtual environment.
  • using virtualenvwrapper
$ mkvirtualenv company-roles
$ workon company-roles
  • Clone this repository:
git clone git@github.com:dann254/company-roles-api.git
  • switch to the project folder:
cd company-roles-api
  • install requirements:
pip install -r requirements.txt
  • Create a postgreSQL database:
createdb company-roles

- follow appropriate tutorials for other DB managers

  • Create a .env file in the project the directory (database-api/company-roles/) with the following format.
  export DB_URL="postgres://USER:PASSWORD@HOST:PORT/company-roles-db"
  export CURRENT_ENV="development"
  export SECRET_KEY="your-secret-key"
  • instructions for setting up DB_URL on other recomended DB managers are found Here.

  • Run migrations from the project root directory to update the database

python manage.py migrate
  • To start the app, run:
python manage.py runserver
  • All set up, you can now use the url http://127.0.0.1:8000/ to access the app from your development server. 🤗

  • The API docs and relevant endpoints will be availabe in GIU by accessing the URL on a browser.

  • running tests

    After setting up your development environment

    • run tests using the following command:
    ./manage.py test
  • Django SuperUser

    After setting up your development environment

    • add a super user using the following command:
    python manage.py createsuperuser --email email@example.com

About


Languages

Language:Python 100.0%