GithubHelp home page GithubHelp logo

isabella232 / django-project-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from edoburu/django-project-template

0.0 0.0 0.0 638 KB

Django project layout to quickly start build fantastic websites! (included npm, libsass, frontend setup and base Django apps)

Python 45.01% CSS 9.01% Shell 0.91% HTML 18.42% JavaScript 18.30% Makefile 2.03% Dockerfile 6.32%

django-project-template's Introduction

https://img.shields.io/travis/edoburu/django-project-template/master.svg?branch=master

Django project template

This project template creates a Django 1.11 / 2.0 project with a base set of applications

Features

Installed apps:

Configured URLs:

  • /robots.txt
  • /sitemap.xml
  • /admin/

Templates:

  • base.html
  • 403.html
  • 404.html
  • 500.html

Features:

  • 12factor app settings
  • WSGI deployment scripts
  • CSS and JavaScript paths configured
  • HTML5shiv + jQuery Installed
  • Bootstrap 3 based CSS reset
  • Dockerfile available
  • Gulpfile with SASS, LiveReload and spritesmith setup (can be discarded)
  • Uptime monitoring URL (/api/health/)

Usage

Create a Django project:

mkdir my-website.com
cd my-website.com
django-admin.py startproject mywebsite . -e py,rst,example,gitignore,ini,min -n Dockerfile --template=https://github.com/edoburu/django-project-template/archive/master.zip

The layout uses an src folder. This allows you to create folders like docs, web, logs, etc at the toplevel. However, feel free to undo this change.

The remaining instructions - to start the development server - can be found in the generated README.rst file.

Django-fluent template

In a second branch, you'll find a project template for the django-fluent CMS:

mkdir my-website.com
cd my-website.com
django-admin.py startproject mywebsite . -e py,rst,example,gitignore,ini,min -n Dockerfile --template=https://github.com/edoburu/django-project-template/archive/django-fluent.zip

Optional features

As extra treat, the CSS files are easier to edit using SASS. Changes are automatically visible in the browser using LiveReload.

Note

This feature is optional. If you don't like to use it, the project already has a screen.css file which can be used and edited. Feel free to remove those files in your own projects or fork (gulpfile.js, package.json, and frontend/sass). However, we highly recommended to take a look at it.

Local testing

A quick script to allow local testing:

sed -i -e 's/{{ project_name }}/project_name/g' Dockerfile src/project_name/settings/*.py src/*.py src/frontend/views.py src/tests/test_wsgi.py
sed -i -e 's/{{ secret_key|safe }}/c6!x_#)=rim8n1j90f#al%m9i)zb2zu@i)846ps_&%-5@6o=q6/g' src/project_name/settings/defaults.py

{{ project_name|title }} Project

About

Describe your project here.

Prerequisites

  • Python >= 2.7
  • pip
  • virtualenv (virtualenvwrapper is recommended)

Installation

To setup a local development environment:

virtualenv env --prompt="({{ project_name }})"  # or mkvirtualenv {{ project_name }}
source env/bin/activate

cd src
make

cp {{ project_name }}/settings/local.py.example {{ project_name }}/settings/local.py  # To enable debugging
edit {{ project_name }}/settings/local.py    # Enter your DB credentials

sudo su - postgres
createuser {{ project_name }}  -P   # testtest is the default password
createdb --template=template0 --encoding='UTF-8' --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8' --owner={{ project_name }} {{ project_name }}
exit

./manage.py migrate
./manage.py runserver

Compiling SASS files

Sass files are compiled to CSS during the development. At the server, there is no need for installing development tools.

To setup your development system, install NodeJS from https://nodejs.org/. On Mac OSX, you can also use brew install libsass node.

Run the following command to compile SASS files:

make watch

This will compile the files, and watch for changes. It also has LiveReload support. Install a browser plugin from: http://livereload.com/extensions/ and toggle the "LiveReload" button in the browser to see CSS changes instantly.

License

Describe project license here.

django-project-template's People

Contributors

paolodina avatar polinom avatar pyup-bot avatar vdboor 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.