Skip to main content

Django Rule Management System app

Project description

RMS (Rule Management System) is a Django app which allow manage several data
rules in oreder to server then by locale.


Getting Django


Execute next commands as root. Note that some of the following intrucctions
are based on YUM. For any other packages manager you should use equivalent

- Base packages needed::

yum install gcc python-devel # in order to compile PIL (Python Image Library)
yum install python-simplejson.i686
yum install python-setuptools.noarch

-Getting PiP (Python package Index)::

curl | python

- Installing Django::

pip install Django

Getting RMS Django application

- Get a clone of RMS Git repository.
- Go into local git repository.
- Install RMS application::

python install

Getting a Django project enviroment for the RMS Django application

Starting a Django project enviroment for the RMS Django application

Execute as `root` in order to start a Django project::

adduser django
mkdir /var/local/django
chown django:django /var/local/django
su django
cd /var/local/django startproject www_rms

Setting RMS Django application

- Extra settings availables in ``::

HTTP_CACHE_CONTROL = 'max-age=600, must-revalidate'

See more about on

- In `/var/local/django/www_rms/` dir, edit `` as follow::

# Django settings for www_rms project.

DEBUG = True

# ('Your Name', ''),


import os
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))

'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': os.path.join(PROJECT_DIR, 'www_rms.db'), # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.

# Local time zone for this installation. Choices can be found here:
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'

HTTP_CACHE_CONTROL = 'max-age=600, must-revalidate'

# Language code for this installation. All choices can be found here:



# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/"
MEDIA_ROOT = '/var/local/django/www_rms/media/'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "", ""
MEDIA_URL = '/media/'

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/"
STATIC_ROOT = '/var/local/django/www_rms/static/'

# URL prefix for static files.
# Example: ""
STATIC_URL = '/static/'

# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "", "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'

# Additional locations of static files
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
# "/usr/share/pyshared/feincms/static/",

# List of finder classes that know how to find static files in
# various locations.
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',

# Make this unique, and don't share it with anybody.
SECRET_KEY = '#yj5q&wq@7g)+5a93pey97ae-ru4p#e-3m)vjjko#ggqjz(^_a'

# List of callables that know how to import templates from various sources.
# 'django.template.loaders.eggs.Loader',


ROOT_URLCONF = 'www_rms.urls'

# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
# "/var/local/django/www_rms/templates",

# Uncomment the next line to enable the admin:
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
# See for
# more details on how to customize your logging configuration.
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,

- In `/var/local/django/www_rms/` dir, execute::

python syncdb
# Follow steps showed by the wizard

- In `/var/local/django/www_rms/` dir,edit `` as follow::

from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
from django.contrib import admin


urlpatterns = patterns('',
url(r'^admin/', include(,
url(r'', include('rms.urls')),

# if settings.DEBUG:
urlpatterns += patterns('',
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),

Importing rules from a file with old format

- In `/var/local/django/www_rms/` dir, execute::

cp <<rms git repo dir>>/ .

- Put the file with old format rules in `/var/local/django/www_rms/`.
- Rename file with old rules to `rules.json`
- Execute `python` command

Configuring Nginx


- Install Nginx::

yum install nginx

- Install Flup (Random assortment of WSGI servers)::

pip install flup

Launch RMS Django project as a FastCGI service

- Change to executable the `` file::

chmod +x /var/local/django/www_rms/

- Add folling line to `/etc/rc.local`::

su django -c "/var/local/django/www_rms/ runfcgi \
host= port=8002 outlog=/dev/null errlog=/dev/null"

- Read more about this in Django website::


Setting Nginx

In `/etc/nginx/conf.d/` dir, add `rms.conf` file as following;:

server {

listen 80;

access_log /var/log/nginx/www_rms.access.log;

location / {
# host and port to fastcgi server
fastcgi_param SERVER_NAME $server_name;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param X-Real-IP $remote_addr;
fastcgi_param X-Forwarded-For $remote_addr;

fastcgi_pass_header Authorization;
fastcgi_intercept_errors off;

allow all;


location /static/rms/ {
alias /usr/lib/python2.6/site-packages/django_rms-0.0.0-py2.6.egg/rms/static/rms/;

location /static/admin/ {
alias /usr/lib/python2.6/site-packages/django/contrib/admin/media/;


- Restart Nginx service::

service nginx restart

- Check if the site is running::

w3m http://localhost:80/admin/


* Empty*


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-rms-0.0.0.tar.gz (88.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page