Coder Social home page Coder Social logo

template-project's Introduction

TEMPLATE PROJECT

Logo

TEMPLATE PROJECT

Report Bug/Request Feature

This repository contains ...

Prerequisites

This repository will not work without the following external dependencies:

(back to top)

Structure

The project structure follows the structure below:

  • deploy.sh: this bash file contains the deployment steps to create a Docker Swarm Stack based on the .env file.
  • app: this directory contains the Django application.
    • apps: this directory contains all the reusable apps.
    • config: this directory stores the project configuration files:
      • .env: contains environment variables
      • config.ini: contains logger configuration
      • environment.py: contains pydantic environment model
    • tools: this directory stores reusable tools:

(back to top)

Getting Started

Create a new environment file .env and place it in the src/configs directory, then add the follow environment variables:

### GENERAL
DEBUG=True

Create a new virtual environment by running the command below:

python -m venv .venv

Activate it in a Linux enviroment by running:

source .venv/bin/activate

or in a Windows enviroment by running:

.\.venv\Scripts\activate

Install the dependencies by running:

pip install -r requirements.txt

Run the App

In order to run the app localy you need to locate in root dir and run:

python src/main.py

If you are developing with vscode, the .vscode folder contains the launch.json to be able to run the app in debugging mode.

Deploy the App

If you want to deploy the app into a Docker container using Docker Swarm as a container orchertrator you can simply run:

./deploy.sh

The script builds a container image with the source code, then it creates a stack with some container repliacas, a network and a Swarm service.

Enjoy!

(back to top)

Requirements

Compile dependencies

Run the following command to install pip-tools that is required to compile the requirements.txt

pip install pip-tools

In order to compile the requirements.txt file based on a pyproject.toml file, run the following command:

pip-compile --resolver=backtracking --output-file=requirements.txt pyproject.toml

Setup pre-commit

In order to initialize the environment for pre-commit-hooks run the following command:

pre-commit install

Run tests

In order to run tests with coverage report run this command:

pytest -v -W ignore --cov=. --cov-config=config/.coveragerc tests/

(back to top)

Contact

Stefano Ravagnan - [email protected]

Project Link: https://github.com/sravagnan/template-project

(back to top)

template-project's People

Contributors

sravagnan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.