Travel Mate Server (Project: Nomad)

Build Status

Django 2.0 server for Travel Mate


  • For new feature request in the app, open a new feature request on the main repository
  • For reporting bug in existing APIs, open a new issue on this repository

Local setup instructions

  • Clone the project from source
git clone && cd server
  • Setup virtual environment
pip install virtualenv
virtualenv venv --python=python3.6

Now activate the environment shell with:

source venv/bin/activate  # On Linux


venv\Scripts\activate  & :: On Windows
  • Install all dependencies
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 ;
  • Database migrations
python makemigrations
python migrate
  • Run Tests
python test
  • Finally! Run server
python runserver

Open localhost:8000

  • To access Django Admin
python 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: [email protected]
Password (again):
Superuser created successfully.
  • Re-run the server
python 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

  • Make a POST call to /api/sign-up with 4 form-data body objects: email, password, firstname, lastname. You should get "Successfully registered" response with 201 status code.
  • Make a POST call to /api/sign-in with 2 form-data body objects: username (which is your email Id you used for sign up), password. You will get a token in JSON response, store it somewhere.
  • For making any subsequent request, use the above token by sending it as an "Authorization HTTP Header", eg: Authorization: Token

Download source code from Github

Download ZIP

Submit resources