It takes time to start a Django Project and make it almost production-ready.

Overview

django-setup-cli

Django Setup Cli

GitHub Actions (Tests) codecov

It takes time to start a Django Project and make it almost production ready. A developer needs to spend a lot of time installing required libraries, setup database, setup cache as well as hiding secrets, configure settings file. With the help of django-setup-cli a developer can start an almost production ready project in a minute.

Requirements

python 3.6>

Installation

1. Create a virtual environment and activate

windows

 pip install virtualenv
 virtualenv venv
 <YOUR WORKING DIRECTORY>/venv/scripts/activate

Your Current Working Directory

Ubuntu [Debian]

sudo apt-get install python3-pip
sudo pip3 install virtualenv 
virtualenv venv 
source venv/bin/activate

you can use any name instead of venv

2. Install django-setup-cli

pip3 install django-setup-cli

Usages

How to use

Usage: django-cli [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  generate      Generates YAML File
  startproject  Starts Django Project

1. startproject

Option 1:

Similar to django-admin startproject

If there's no valid setup.yaml file in your working directory django-cli will take some input to start the project

To Start a project use the following command in the shell

django-cli startproject PROJECT_NAME

Note: PROJECT_NAME is optional

>> django-cli startproject ProjectName[Optional]

1. Project Name
Your Project Name: T

2. Install Necessary Libraries
Install Libraries [y/N]: y

1.Install djangorestframework [y/N]: y
2.Install graphene-django [y/N]: y
3.Install django-channels [y/N]: y
4.Install django-localflavor [y/N]: y
5.Install celery [y/N]: y
6.Install whitenoise [y/N]: y
7.Install django-filter [y/N]: y
8.Install django-extensions [y/N]: y
9.Install django-storages [y/N]: y

3. Static File
Create/Use Static File [y/N]: y

4. Template File
Create/Use Template File [y/N]: y

5. Media File
Create/Use Media File [y/N]: y

6. Setup Database
Setup Database [Skip To Use Default] [y/N]: y
1. postgresql
2. mysql
3. maria_db
4. oracle
5. mssql
6. sqlite3
7. django_cockroachdb

Database Engine: 1
Database Name: DATABASE_NAME
Database User: USER
Database Password: PASSWORD
Database Host: localhost
Database Port: 5432

7. Setup Cache
Install Cache [y/N]: y

1. pymemcache
2. redis
3. DatabaseCache
4. FileBasedCache
5. LocMemCache

Cache Engine: 2
Cache Location: LOCATION

After Providing required Information Your Project will be created and you will see following output

1. Installing Required Libraries
installing django
...
...
2. Creating Source Directory
..
3. Creating Project File

Project Setup Complete

Your working directory will have the following files and folders

project
│   README.md
│   .gitignore    
│   .env       [Django Secrets]
|   setup.yaml [django-cli YAML Setup Config File]  
└───src
   │   manage.py
   │   
   └───PROJECT_NAME
       │   asgi.py
       │   config.py
       │   settings.py   
       |   wsgi.py
       |   urls.py 

Note: Do not delete .env file, it will contain database, cache and django secret keys

Option 2:

1. Create a setup.yaml file

name: TEST_PROJECT
libraries:
- django-rest-framework
- celery
- django-storages
template: true
static: true
media: false
database:
  engine: postgresql
  user: user
  password: password
  host: host
  port: port
  option: 
    config: psql.cfg
cache:
  backend: redis
  location: localhost:6532
env:
  SECRET_KEY: YOUR_SECRET_KEY

2. Run django-cli startproject in terminal/shell

django-cli startproject
# Your Project Will be created automatically using the setup.yaml file

Use Environment Variable in setup.yaml

It is possible to use secrets I.E [Database Password, Username, Secret Key] using environment variable

To Hide Secrets Using environment variable create a cli.env file in the source directory And do the following

cli.env

MY_SECRET_KEY=
   
    
DATABASE_USER=django_cli
DATABASE_PASSWORD=gonnaCry?

   

setup.yaml

To use env secret Put $ before your env variable I.E $SECRET_KEY

name: TEST_PROJECT
libraries:
- django-rest-framework
- celery
- django-storages
template: true
static: true
media: false
database:
  engine: postgresql
  user: $DATABASE_USER
  password: $DATABASE_PASSWORD
  host: host
  port: port
  option: 
    config: psql.cfg
cache:
  backend: redis
  location: localhost:6532
env:
  SECRET_KEY: $MY_SECRET_KEY

You can target a different env file using --env django-cli startproject NewProject --env spider.env

2. generate

django-cli generate PROJECT_NAME --env cli.env

Will generate setup.yaml file, it will not create project PROJECT_NAME and --env are optional fields

3. install

django-cli install

Will install required libraries also install libraries that are inside requirements.txt file

@Creator and Maintainer

Khan Asfi Reza

You might also like...
pytest-django allows you to test your Django project/applications with the pytest testing tool.

pytest-django allows you to test your Django project/applications with the pytest testing tool.

django-dashing is a customisable, modular dashboard application framework for Django to visualize interesting data about your project. Inspired in the dashboard framework Dashing
django-dashing is a customisable, modular dashboard application framework for Django to visualize interesting data about your project. Inspired in the dashboard framework Dashing

django-dashing django-dashing is a customisable, modular dashboard application framework for Django to visualize interesting data about your project.

Intellicards-backend - A Django project bootstrapped with django-admin startproject mysite

Intellicards-backend - A Django project bootstrapped with django-admin startproject mysite

Get inside your stronghold and make all your Django views default login_required

Stronghold Get inside your stronghold and make all your Django views default login_required Stronghold is a very small and easy to use django app that

💨  Fast, Async-ready, Openapi, type hints based framework for building APIs
💨 Fast, Async-ready, Openapi, type hints based framework for building APIs

Fast to learn, fast to code, fast to run Django Ninja - Fast Django REST Framework Django Ninja is a web framework for building APIs with Django and P

A Django chatbot that is capable of doing math and searching Chinese poet online. Developed with django, channels, celery and redis.

Django Channels Websocket Chatbot A Django chatbot that is capable of doing math and searching Chinese poet online. Developed with django, channels, c

Blog focused on skills enhancement and knowledge sharing. Tech Stack's: Vue.js, Django and Django-Ninja

Blog focused on skills enhancement and knowledge sharing. Tech Stack's: Vue.js, Django and Django-Ninja

Meta package to combine turbo-django and stimulus-django

Hotwire + Django This repository aims to help you integrate Hotwire with Django 🚀 Inspiration might be taken from @hotwired/hotwire-rails. We are sti

django-quill-editor makes Quill.js easy to use on Django Forms and admin sites
django-quill-editor makes Quill.js easy to use on Django Forms and admin sites

django-quill-editor django-quill-editor makes Quill.js easy to use on Django Forms and admin sites No configuration required for static files! The ent

Comments
Releases(v1.0.17)
Owner
Khan Asfi Reza
Full Stack Developer, experienced in languages and frameworks like Python, TypeScript, Sass, Django, React, Vue, etc
Khan Asfi Reza
Simple XML-RPC and JSON-RPC server for modern Django

django-modern-rpc Build an XML-RPC and/or JSON-RPC server as part of your Django project. Major Django and Python versions are supported Main features

Antoine Lorence 82 Dec 04, 2022
Imparare Django ricreando un sito facsimile a quello Flask

SitoPBG-Django Imparare Django ricreando un sito facsimile a quello Flask Note di utilizzo Necessita la valorizzazione delle seguenti variabili di amb

Mario Nardi 1 Dec 08, 2021
Simple web site for sharing your short stories and beautiful pictures

Story Contest Simple web site for sharing your short stories and beautiful pictures.(Cloud computing first assignment) Clouds The table below shows cl

Alireza Akhoundi 5 Jan 04, 2023
Notes-Django: an advanced project to save notes in Django. where users are able to Create, Read, Update and Delete their notes.

An advanced software to keep you notes. It allows users to perform CRUD operations on theirs Notes. Was implemented Authorization and Authentication

Edilson Pateguana 1 Feb 05, 2022
Built from scratch to replicate some of the Django admin functionality and add some more, to serve as an introspective interface for Django and Mongo.

django-mongonaut Info: An introspective interface for Django and MongoDB. Version: 0.2.21 Maintainer: Jazzband (jazzband.co) This Project is Being Mov

Jazzband 238 Dec 26, 2022
Django + NextJS + Tailwind Boilerplate

django + NextJS + Tailwind Boilerplate About A Django project boilerplate/templa

Shayan Debroy 3 Mar 11, 2022
Easy thumbnails for Django

Easy Thumbnails A powerful, yet easy to implement thumbnailing application for Django 1.11+ Below is a quick summary of usage. For more comprehensive

Chris Beaven 1.3k Dec 30, 2022
A Django web application to receive, virus check and validate transfers of digital archival records, and allow archivists to appraise and accession those records.

Aurora Aurora is a Django web application that can receive, virus check and validate transfers of digital archival records, and allows archivists to a

Rockefeller Archive Center 20 Aug 30, 2022
A Django app for managing robots.txt files following the robots exclusion protocol

Django Robots This is a basic Django application to manage robots.txt files following the robots exclusion protocol, complementing the Django Sitemap

Jazzband 406 Dec 26, 2022
The uncompromising Python code formatter

The Uncompromising Code Formatter “Any color you like.” Black is the uncompromising Python code formatter. By using it, you agree to cede control over

Python Software Foundation 30.7k Jan 03, 2023
Super simple bar charts for django admin list views visualizing the number of objects based on date_hierarchy using Chart.js.

Super simple bar charts for django admin list views visualizing the number of objects based on date_hierarchy using Chart.js.

foorilla LLC 4 May 18, 2022
Wrap the Blockchain API in Django!

django-blockchain Wrap the Blockchain API in Django. Installation pip install django-blockchain Add app in your settings.py INSTALLED_APPS = [ "d

Dmitry Kalinin 2 Feb 04, 2022
Hello world written in Django.

Learning Django 💡 create a virtual environment create python -m venv ./venv. this virtualenv file will be excluded by .gitignore activate the virtual

Dipak giri 4 Nov 26, 2021
Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.

Cookiecutter Django Powered by Cookiecutter, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. Documentati

10.1k Jan 08, 2023
A tool to automatically fix Django deprecations.

A tool to help upgrade Django projects to newer version of the framework by automatically fixing deprecations. The problem When maintaining a Django s

Bruno Alla 155 Dec 14, 2022
Forward and backwards compatibility layer for Django 1.4, 1.7, 1.8, 1.9, 1.10, and 1.11

django-compat Forward and backwards compatibility layer for Django 1.4 , 1.7 , 1.8, 1.9, 1.10 and 1.11 Consider django-compat as an experiment based o

arteria GmbH 106 Mar 28, 2022
Django CacheMiddleware has a multi-threading issue with pylibmc

django-pylibmc-bug Django CacheMiddleware has a multi-threading issue with pylibmc. CacheMiddleware shares a thread-unsafe cache object with many thre

Iuri de Silvio 1 Oct 19, 2022
django app that allows capture application metrics by each user individually

Django User Metrics django app that allows capture application metrics by each user individually, so after you can generate reports with aggregation o

Reiner Marquez 42 Apr 28, 2022
Django And React Notes App

Django & React Notes App Cloning the repository -- Clone the repository using the command below : git clone https://github.com/divanov11/Django-React

Dennis Ivy 136 Dec 27, 2022
A pluggable Django application for integrating PayPal Payments Standard or Payments Pro

Django PayPal Django PayPal is a pluggable application that integrates with PayPal Payments Standard and Payments Pro. See https://django-paypal.readt

Luke Plant 672 Dec 22, 2022