Giter Site home page Giter Site logo

djangle's Introduction

[...put project description here...]

This project uses "djangle" template for developing & deployment. See instructions below.


Cheatsheet

Djangle is a template which simplifies development & deployment of django apps. It's based on docker & docker-compose.

Start new project locally

This covers case when you want to start completely new project and don't have any code yet.

First, create a project folder and init git repo:

mkdir new_project && cd new_project
git init
git config user.name "your name"
git config user.email "your email"

Then, set up djangle as one of remotes, and pull latest version. This will create a branch named djangle/template which is a skeleton for any new project:

git remote add djangle [email protected]:c0ntribut0r/djangle.git
git fetch --all

Now you have a djangle/template branch which contains latest djangle configuration and which you may use to generate project structure. Your master branch is still empty, let's populate if from djangle/template branch:

git merge djangle/template

Almost done! Now you can setup python venv for local development:

python -m venv venv
source venv/bin/activate
pip install --upgrade pip -r requirements.txt

Now you should be able to start development. Launch containers in foreground:

# run from project root folder; may require sudo
docker-compose up redis postgres

Switch to another terminal, activate venv and run dev Django server:

source venv/bin/activate
src/manage.py migrate
src/manage.py runserver

Visit http://127.0.0.1:8000 and ensure that you may see greetings page.

Set up server

# on server
apt-get update && apt-get upgrade
apt-get install fish docker-compose git rsync
chsh -s /usr/bin/fish

NAME=project
mkdir $NAME && cd $NAME
git init
git config receive.denyCurrentBranch updateInstead

...

# on server
nano .git/hooks/post-receive

# ---
#!/bin/sh -eux
cd /root/project
sh bin/deploy.sh
# ---

chmod +x .git/hooks/post-receive

Pull updates

git fetch djangle
git merge djangle/template

Deploy

Change all values in .envrc carefully on production server.

Update

Manage

bin/django-manage.sh command \"arg with space\"

Test

  • nox

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.