Home

Awesome

Travel Mate Server (Project: Nomad)

Build Status

Django 2.0 server for Travel Mate

Contribute

Local setup instructions

git clone https://github.com/project-travel-mate/server && cd server
pip install virtualenv
virtualenv venv --python=python3.6

Now activate the environment shell with:

source venv/bin/activate  # On Linux

or

venv\Scripts\activate  & :: On Windows
pip install -r requirements.txt

For Linux-

$ sudo -u postgres createuser nomad
$ sudo -u postgres createdb nomad

$ sudo -u postgres psql
psql=# alter user nomad with encrypted password 'pass';
psql=# grant all privileges on database nomad to nomad ;
psql=# ALTER USER nomad CREATEDB ;

For Windows-

The complete path>psql -U postgres -h localhost
Password:The one given during setup of postgres.
postgres=# create database nomad;
postgres=# create user nomad;
postgres=# alter user nomad with encrypted password 'pass';
postgres=# grant all privileges on database nomad to nomad ;
postgres=# ALTER USER nomad CREATEDB ;
python manage.py makemigrations
python manage.py migrate
python manage.py test
python manage.py runserver

Open localhost:8000

python manage.py createsuperuser

When prompted, type your username (lowercase, no spaces), email address, and password. For example, the output should look like this:

Username: nomadadmin
Email address: nomadadmin@nomad.com
Password:
Password (again):
Superuser created successfully.
python manage.py runserver

Open localhost:8000/admin

Working with authenticated APIs

You would need to have a registered user, with which you can generate a authentication token. Follow the following steps to generate a token (You can download Postman client to make the following POST calls) Reference: TokenAuthentication API docs