Giter Club home page Giter Club logo

playground's Introduction

generic django project

This is my starting point for a new Django site, mixed and stirred from several public sources and spiced with my own enhancements.

I normally work with FeinCMS and its medialibrary, but sometimes also with Photologue, this is reflected in my setups.

My webserver of choice is Nginx with gunicorn, since my virtual server is always low on memory. Setup for Apache with mod_wsgi and Nginx with fcgi is also provided.

Requirements

  • server OS: Debian/Ubuntu based Linux
  • local OS: MacOS X (only some local settings are OSX specific)
  • web server: Apache/mod_wsgi or Nginx/gunicorn or Nginx/fcgi
  • Python version: 2.5+
  • Django version: 1.4
  • version control: Git
  • deployment tool: Fabric
  • local development database: SQLite3
  • server database: MySQL or PostgreSQL
  • database migration: South
  • process control (optional): daemontools or supervisord

Rationale

Django's startproject doesn't do enough. I'm a programmer, thus lazy, and try to reduce redundant work like repeating the same setup steps over and over. (DRY)

Just copying/cloning this generic project to a new site isn't ideal either, since general changes don't affect all dependent sites, but I got no idea how to do that.

Issues

  • Probably security holes - use at your own risk.
  • I could also support runit, but I didn't want to replace init
  • South still doesn't work for me, must overcome problems with several releases and multiple projects accessing the same Django app outside of virtualenvs

Ideas

How To

local:

  • copy generic_project
  • replace all occurrences of lowercase "playground" with your project name. this is also the webserver and database server username!
  • check the settings in manage.py, fabfile.py, gunicorn-settings.py, settings.py, settings_local.py, supervisor.ini or service-run.sh
  • set up an email account for your project’s error messages and configure it in settings.py
  • if you use Nginx, change the internal port in nginx.conf (fastcgi_pass 127.0.0.1:8001;); I use "8 + last 3 numbers of UID" (UIDs start at 1000 on Debian): id -u playground
  • git init, always commit all changes
  • manage syncdb (initialize south)
  • fab webserver setup (once)
  • fab webserver deploy (publish new release - always last committed version!)

server:

I suggest to use makeuser.sh to create system and database accounts. Otherwise:

  • create user and sudo-enable it (I suggest via a group like wheel, but you can also add the user to sudoers):

    adduser playground
    adduser playground wheel
    
  • create database user and database (schema)

    mysql -u root -p
    
    # at first setup only: we installed MySQL without user interaction, so there's no root password. Set it!
    use mysql;
    update user set password=password('...') where user='root';
    
    # create user and database for our project:
    create user 'playground'@'localhost' identified by '...';
    create database playground character set 'utf8';
    grant all privileges on playground.* to 'playground'@'localhost';
    
    flush privileges;
    quit;
    

FeinCMS

If you use FeinCMS’ Page, consider first, which extensions you’ll need – see the docs and the FAQ – afterwards you would need to change the database table page_page by hand, since the changes aren’t detected by South!

Links / Sources

Setup:

Modules:

playground's People

Contributors

fiee avatar alexberryman avatar

Watchers

James Cloos 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.