Skip to content

A simple rest endpoint that makes oauth secured rest calls to itself. Yes

License

Notifications You must be signed in to change notification settings

apexDev37/Recursive-REST

Repository files navigation

Recursive-REST · Inline docs Docker version Python version PRs Welcome Activity

A simple devops-inspired template for Django applications setup with compose.

Introduction

Recursive-REST is a small application that exposes a REST endpoint and calls itself, itself using OAuth 2.0. This repository is mostly for experimentation, exploring Django community tools, and testing the behavior of specific functionality of interest. Let's get recursive! Any comments, feedback, and contributions are highly appreciated.  I always love to hear and learn from the community❤

Learn more about the Django framework from the official documentation.

Installing / Getting started

This is an overview of the minimal setup needed to get started.

Prerequisites

Follow these tutorials on setting up Docker and Compose on either Mac or Linux. I'd recommend Microsoft's documentation to set up Docker on WSL2 if you're on Windows.

Local Setup

The following setup was run on Ubuntu focal (20.04.6 LTS)

You can clone this repo with the following command.

  • Clone repository
    # cd your/desired/target/dir
    $ git clone git@github.com:apexDev37/Recursive-REST.git
    $ cd my-project

This will clone the repository to a target dir on your host machine with a custom name my-project/ and navigate into its root dir.

Configuration

Before running your application with Compose, configure your environment variables in the ./.envs/ directory. Example env files are provided to configure the following instances: Django and Postgres. You can create the required env files with the following code snippet.

  • Create env files
    # ensure you're in the project's root
    $ for file in .envs/*.example; do cp "$file" "${file%.example}"; done
    $ cd .envs/

This will loop through all the files in the .envs/ directory that end with .example and creates new files without the .example extension (ie. django.env.example -> django.env).

NOTE: After the env files are created, replace the placeholders in the files with your own values specific to your Django application and Postgres container.

Launch

You're all set to run your Django application. Spin up your Django and Postgres instances with the following command.

  • Spin up containers
    $ docker compose down
    $ docker compose up -d

This will create and start the Django and Postgres instances in the same network defined in the compose file.

Once the containers have been created and started, you can access the application at http://localhost:8000 Successful Django Install Page

Licensing

To make a repository open source, you must license it so that others may freely use, modify, and distribute the software. Using the MIT license, this project ensures this. The full original text version of the license may be seen here. To apply the right to your repository, follow the procedures.