test2

Tiglath Suriol tiglathsuriol at gmail.com
Tue Mar 24 23:11:04 EDT 2015


# Django settings for ipdb project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', 'your_email at example.com'),
    ('jol', 'tegijjjlath.net'),
    ('totis', 'tis at oint.com'),
)

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE':    'django.db.backends.postgresql_psycopg2',
        'NAME':      'ipdb_db',        # Or path to database file if using sqlite3.
        'USER':      'ipdb',           # Not used with sqlite3.
        'PASSWORD':  'admin',          # Not used with sqlite3.
        'HOST':      'localhost',      # Set to empty string for localhost (NOT TRUE). Not used with sqlite3.
        'PORT':      '',               # Set to empty string for default. Not used with sqlite3.
    }
}

PROJECT_PATH = '/var/opt/ipdb/ipdb/' # this dir contains 'ipdb' and 'manage.py'
GEOIP_PATH   = PROJECT_PATH + '/ipdb/asset/geo'
AS_IPV4_PATH = PROJECT_PATH + '/ipdb/asset/geo/GeoIPASNum.dat'
AS_IPV6_PATH = PROJECT_PATH + '/ipdb/asset/geo/GeoIPASNumv6.dat'
RUN_DIR      = PROJECT_PATH + '/ipdb/asset/run'
LOCK_FILE    = PROJECT_PATH + '/ipdb/asset/crawler.pid'



# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/Atikokan'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# 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

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = PROJECT_PATH + '/ipdb/asset/media/'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
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/media.lawrence.com/static/"
STATIC_ROOT = PROJECT_PATH + '/ipdb/asset/static/'

#
#  Temporary client files.
#
FILE_UPLOAD_DIR = '/tmp/'

LOG_DIR = PROJECT_PATH + '/ipdb/asset/log/'

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
    # 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.
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = '42=kv!a-il*!4j&7v+0(@a at vq_3j-+ysatta@l6-h63odj2)75'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    # Uncomment the next line for simple clickjacking protection:
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': '127.0.0.1:11211',
    }
}

SESSION_ENGINE = 'django.contrib.sessions.backends.cache'

ROOT_URLCONF = 'ipdb.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'ipdb.wsgi.application'

TEMPLATE_DIRS = (
    # 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.
    PROJECT_PATH + '/ipdb/asset/templates', # Change this to your own directory.
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    'django.contrib.admindocs',
    'django.contrib.flatpages',
    'ipdb.asset',
    'registration',
)

# 
# Send logs to the console and to a file. 
#
LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'standard': {
            'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
            'datefmt' : "%d/%b/%Y %H:%M:%S"
        },
    },
    'handlers': {
        'null': {
            'level':'DEBUG',
            'class':'django.utils.log.NullHandler',
        },
        'logfile': {
            'level':'DEBUG',
            'class':'logging.handlers.RotatingFileHandler',
            'filename': LOG_DIR + "/ipdb.log",
            'maxBytes': 50000,
            'backupCount': 2,
            'formatter': 'standard',
        },
        'console':{
            'level':'DEBUG',
            'class':'logging.StreamHandler',
            'formatter': 'standard'
        },
    },
    'loggers': {
        'django': {
            'handlers':['console'],
            'propagate': True,
            'level':'DEBUG',
        },
        'django.db.backends': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False,
        }#from django.conf.urls.defaults import patterns, include, url
from django.conf import *
from django.conf.urls.static import static
from django.views.static import serve
from django.conf.urls import *
#from ip_db.views import ipdb_input_add, ipdb_input_start, ipdb_input_delete, ipdb_input_save, ipdb_api_add, ipdb_api_search
from asset.views import api_add, api_search,  gui_search, gui_add, ipdb_overview, api_file
from asset.utils.elastic_func import country_tally, grid, newest_to_oldest, country_tally_web_top10, country_tally_web, asset_tally
from django.http import HttpResponsePermanentRedirect
from django.shortcuts import render_to_response
from django.contrib import admin
admin.autodiscover()

import os

PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('asset.views',
    # Examples:
    # url(r'^$', 'ipdb.views.home', name='home'),
    # url(r'^ipdb/', include('ipdb.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
    #(r'^accounts/', include('registration.urls')),
    (r'^$', lambda request: HttpResponsePermanentRedirect('/asset/overview')),
    (r'^heatmap/', country_tally),
    (r'^grid/',grid),
    (r'^nto/',newest_to_oldest),
    (r'^ctwtt/',country_tally_web_top10),
    (r'^ctw/',country_tally_web),
    (r'^at/',asset_tally),

     #(r'^/$', ipdb_overview), #Start
     #(r'^$', ipdb_overview), #Start
    (r'^asset/overview/$', ipdb_overview), #Start
    (r'^input/$', gui_add),
    (r'^search/$', gui_search),
    (r'^search$', gui_search),
    # (r'^delete/$', ipdb_input_delete),
    (r'^api/add/$', api_add), #check sensornet urls.py and views/sensors.py for cool tricks.
    (r'^api/search/$', api_search), #check sensornet urls.py and views/sensors.py for cool tricks.
    (r'^api/file/$', api_file),

    #(r'^asset/media/(?P<path>.*)$', 'django.views.static.serve', {'document_root':  os.path.join(PROJECT_PATH, '../asset/media')}),

    #(r'^ip_db/media/(?P<path>.*)$', 'django.views.static.serve', {'document_root':  os.path.join(PROJECT_PATH, 'ip_db/media')}),
    #(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root':  os.path.join(PROJECT_PATH, 'media')}),
    #(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root':  '/home/sensornet/static'}),

    # extjs4 stuff
    #(r'^asset/overview/extjs/(?P<path>.*)$', 'serve', {'document_root':  os.path.join(PROJECT_PATH, '../asset/extjs')}),
    #(r'^extjs/(?P<path>.*)$', 'django.views.static.serve', {'document_root':  os.path.join(PROJECT_PATH, '../ip_db/extjs')}),
    #(r'^extjs/(?P<path>.*)$', 'django.views.static.serve', {'document_root':  '/home/totis/tree/ipdb/django/ipdb/asset/static/extjs'}),
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT),
        'ipdb.asset': {
            'handlers': ['console', 'logfile'],
            'level': 'DEBUG',
        },
    }
}

===========






More information about the Python-list mailing list