authenticate users based on role
- ** admins ** can only be created through the console with the following command.
python manage.py createsuperuser --email email@example.com
- 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.
-
After setting up your development environment
- run tests using the following command:
./manage.py test
-
After setting up your development environment
- add a super user using the following command:
python manage.py createsuperuser --email email@example.com