/django-heroku-rest-api

A Django 2.0 Rest-API with Heroku integration

Primary LanguagePythonMIT LicenseMIT

Django 2.0 - Rest-API with Heroku Integration

A REST api written in Django for people with deadlines

Technologies used

  • Django: The web framework for perfectionists with deadlines (Django builds better web apps with less code).
  • DRF: A powerful and flexible toolkit for building Web APIs

Installation

  • If you wish to run your own build, first ensure you have Python and Heroku globally installed in your computer. If not, you can get python here and Heroku here.

  • After doing this, confirm that you have installed virtualenv globally as well. If not, run this:

        $ pip install virtualenv
  • Then, Git clone this repo to your PC

        $ git clone https://github.com/gitgik/django-rest-api.git
  • Steps

    1. Cd into your the cloned repo as such:
          $ cd django-heroku-rest-api
    2. Create and fire up your virtual environment:
          $ virtualenv  venv -p python3
          $ source venv/bin/activate
    3. Install the dependencies needed to run the app:
          $ pip install -r requirements.txt
    4. Make those migrations work
          $ python manage.py makemigrations
          $ python manage.py migrate
          $ python manage.py createsuperuser
    5. Run It
        $ python manage.py runserver
    1. Test it Locally

      http://localhost:8000/users/

    2. Time to go remote!

    $ heroku login 
    $ heroku create project 
    $ git push heroku master 
    $ heroku run python manage.py migrate 
    $ heroku run python manage.py createsuperuser 

    Your project should now be live at:

    https://heroku_project_name.herokuapp.com/users/

    If you want to set your own project to support Heroku here is a detailed explanation:

    https://gist.github.com/agusalex/70146cb09381c0adc4b3a2f68d035cfa