Browse Source

Made pydash a django app.

windows^2
George Zografos 12 years ago
parent
commit
043d262b51
  1. 0
      example/example/__init__.py
  2. 135
      example/example/settings.py
  3. 4
      example/example/urls.py
  4. 4
      example/example/wsgi.py
  5. 2
      example/manage.py
  6. 1
      example/pydash
  7. 81
      pydash/services.py
  8. 151
      pydash/settings.py
  9. 0
      pydash/static/css/bootstrap-responsive.min.css
  10. 0
      pydash/static/css/bootstrap.min.css
  11. 0
      pydash/static/css/dashboard.css
  12. 0
      pydash/static/css/font-awesome.css
  13. 0
      pydash/static/css/fonts.css
  14. 0
      pydash/static/css/signin.css
  15. 0
      pydash/static/css/style.css
  16. 0
      pydash/static/fonts/MTP_ySUJH_bn48VBG8sNSnhCUOGz7vYGh680lGh-uXM.woff
  17. 0
      pydash/static/fonts/MTP_ySUJH_bn48VBG8sNSonF5uFdDttMLvmWuJdhhgs.ttf
  18. 0
      pydash/static/fonts/PRmiXeptR36kaC0GEAetxi8cqLH4MEiSE0ROcU-qHOA.ttf
  19. 0
      pydash/static/fonts/PRmiXeptR36kaC0GEAetxn5HxGBcBvicCpTp6spHfNo.woff
  20. 0
      pydash/static/fonts/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff
  21. 0
      pydash/static/fonts/cJZKeOuBrn4kERxqtaUH3aCWcynf_cDxXwCLxiixG1c.ttf
  22. 0
      pydash/static/fonts/fontawesome-webfont.eot
  23. 0
      pydash/static/fonts/fontawesome-webfont.svg
  24. 0
      pydash/static/fonts/fontawesome-webfont.ttf
  25. 0
      pydash/static/fonts/fontawesome-webfont.woff
  26. 0
      pydash/static/fonts/glyphicons-halflings-regular.eot
  27. 0
      pydash/static/fonts/glyphicons-halflings-regular.svg
  28. 0
      pydash/static/fonts/glyphicons-halflings-regular.ttf
  29. 0
      pydash/static/fonts/glyphicons-halflings-regular.woff
  30. 0
      pydash/static/fonts/xjAJXh38I15wypJXxuGMBobN6UDyHWBl620a-IRfuBk.woff
  31. 0
      pydash/static/fonts/xjAJXh38I15wypJXxuGMBp0EAVxt0G0biEntp43Qt6E.ttf
  32. 0
      pydash/static/img/asc.gif
  33. 0
      pydash/static/img/bg.gif
  34. 0
      pydash/static/img/desc.gif
  35. 0
      pydash/static/img/favicon.ico
  36. 0
      pydash/static/img/icons-sa7c41345d9.png
  37. 0
      pydash/static/js/Chart.min.js
  38. 0
      pydash/static/js/base.js
  39. 0
      pydash/static/js/bootstrap-multiselect.js
  40. 0
      pydash/static/js/bootstrap.js
  41. 0
      pydash/static/js/bootstrap.min.js
  42. 22
      pydash/static/js/dashboard.js
  43. 0
      pydash/static/js/excanvas.js
  44. 0
      pydash/static/js/jquery.dataTables.min.js
  45. 0
      pydash/static/js/jquery.js
  46. 0
      pydash/templates/base_auth.html
  47. 2
      pydash/templates/login.html
  48. 0
      pydash/templates/logout.html
  49. 65
      pydash/templates/main.html
  50. 46
      pydash/urls.py
  51. 111
      pydash/views.py
  52. 0
      usage/__init__.py

main/__init__.py → example/example/__init__.py

135
example/example/settings.py

@ -0,0 +1,135 @@
"""
Django settings for pydash project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SITE_ID = 1
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '1)$crmowu-23tz@i2-d=7tb3t+1u&(pm!lnjyuarki^72h!3af'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ADMINS = (
)
MANAGERS = ADMINS
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# Add pydash here
'pydash'
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'example.urls'
WSGI_APPLICATION = 'example.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3')
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'templates'),)
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_ROOT = os.path.join(os.path.dirname(__file__), '..', 'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = (
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
try:
from local_settings import *
except ImportError:
pass

4
example/example/urls.py

@ -0,0 +1,4 @@
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^pydash/', include('pydash.urls')))

pydash/wsgi.py → example/example/wsgi.py

manage.py → example/manage.py

1
example/pydash

@ -0,0 +1 @@
../pydash

main/views.py → pydash/services.py

151
pydash/settings.py

@ -1,143 +1,8 @@
"""
Django settings for pydash project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SITE_ID = 1
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '1)$crmowu-23tz@i2-d=7tb3t+1u&(pm!lnjyuarki^72h!3af'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
TEMPLATE_DEBUG = False
ADMINS = (
)
MANAGERS = ADMINS
#All refresh values are in miliseconds, 1 second = 1000 miliseconds
#Adjust accordingly as you wish
TIME_JS_REFRESH = 30000
TIME_JS_REFRESH_LONG = 120000
TIME_JS_REFRESH_NET = 2000
VERSION = "1.4.4"
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = (
#'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
#'django.contrib.sites',
'django.contrib.staticfiles',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'pydash.urls'
WSGI_APPLICATION = 'pydash.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3')
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'templates'),)
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_ROOT = os.path.join(os.path.dirname(__file__), '..', 'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = (
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
try:
from local_settings import *
except ImportError:
pass
from django.conf import settings
# All of the refresh values are in miliseconds, 1 second = 1000 miliseconds
# Adjust accordingly as you wish, preferably in your application's settings.py.
TIME_JS_REFRESH = getattr(settings, 'TIME_JS_REFRESH', 30000)
TIME_JS_REFRESH_LONG = getattr(settings, 'TIME_JS_REFRESH_LONG', 120000)
TIME_JS_REFRESH_NET = getattr(settings, 'TIME_JS_REFRESH_NET', 2000)
_VERSION = '1.4.4'

static/css/bootstrap-responsive.min.css → pydash/static/css/bootstrap-responsive.min.css

static/css/bootstrap.min.css → pydash/static/css/bootstrap.min.css

static/css/dashboard.css → pydash/static/css/dashboard.css

static/css/font-awesome.css → pydash/static/css/font-awesome.css

static/css/fonts.css → pydash/static/css/fonts.css

static/css/signin.css → pydash/static/css/signin.css

static/css/style.css → pydash/static/css/style.css

static/fonts/MTP_ySUJH_bn48VBG8sNSnhCUOGz7vYGh680lGh-uXM.woff → pydash/static/fonts/MTP_ySUJH_bn48VBG8sNSnhCUOGz7vYGh680lGh-uXM.woff

static/fonts/MTP_ySUJH_bn48VBG8sNSonF5uFdDttMLvmWuJdhhgs.ttf → pydash/static/fonts/MTP_ySUJH_bn48VBG8sNSonF5uFdDttMLvmWuJdhhgs.ttf

static/fonts/PRmiXeptR36kaC0GEAetxi8cqLH4MEiSE0ROcU-qHOA.ttf → pydash/static/fonts/PRmiXeptR36kaC0GEAetxi8cqLH4MEiSE0ROcU-qHOA.ttf

static/fonts/PRmiXeptR36kaC0GEAetxn5HxGBcBvicCpTp6spHfNo.woff → pydash/static/fonts/PRmiXeptR36kaC0GEAetxn5HxGBcBvicCpTp6spHfNo.woff

static/fonts/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff → pydash/static/fonts/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff

static/fonts/cJZKeOuBrn4kERxqtaUH3aCWcynf_cDxXwCLxiixG1c.ttf → pydash/static/fonts/cJZKeOuBrn4kERxqtaUH3aCWcynf_cDxXwCLxiixG1c.ttf

static/fonts/fontawesome-webfont.eot → pydash/static/fonts/fontawesome-webfont.eot

static/fonts/fontawesome-webfont.svg → pydash/static/fonts/fontawesome-webfont.svg

static/fonts/fontawesome-webfont.ttf → pydash/static/fonts/fontawesome-webfont.ttf

static/fonts/fontawesome-webfont.woff → pydash/static/fonts/fontawesome-webfont.woff

static/fonts/glyphicons-halflings-regular.eot → pydash/static/fonts/glyphicons-halflings-regular.eot

static/fonts/glyphicons-halflings-regular.svg → pydash/static/fonts/glyphicons-halflings-regular.svg

static/fonts/glyphicons-halflings-regular.ttf → pydash/static/fonts/glyphicons-halflings-regular.ttf

static/fonts/glyphicons-halflings-regular.woff → pydash/static/fonts/glyphicons-halflings-regular.woff

static/fonts/xjAJXh38I15wypJXxuGMBobN6UDyHWBl620a-IRfuBk.woff → pydash/static/fonts/xjAJXh38I15wypJXxuGMBobN6UDyHWBl620a-IRfuBk.woff

static/fonts/xjAJXh38I15wypJXxuGMBp0EAVxt0G0biEntp43Qt6E.ttf → pydash/static/fonts/xjAJXh38I15wypJXxuGMBp0EAVxt0G0biEntp43Qt6E.ttf

static/img/asc.gif → pydash/static/img/asc.gif

static/img/bg.gif → pydash/static/img/bg.gif

static/img/desc.gif → pydash/static/img/desc.gif

static/img/favicon.ico → pydash/static/img/favicon.ico

static/img/icons-sa7c41345d9.png → pydash/static/img/icons-sa7c41345d9.png

static/js/Chart.min.js → pydash/static/js/Chart.min.js

static/js/base.js → pydash/static/js/base.js

static/js/bootstrap-multiselect.js → pydash/static/js/bootstrap-multiselect.js

static/js/bootstrap.js → pydash/static/js/bootstrap.js

static/js/bootstrap.min.js → pydash/static/js/bootstrap.min.js

static/js/dashboard.js → pydash/static/js/dashboard.js

static/js/excanvas.js → pydash/static/js/excanvas.js

static/js/jquery.dataTables.min.js → pydash/static/js/jquery.dataTables.min.js

static/js/jquery.js → pydash/static/js/jquery.js

templates/base_auth.html → pydash/templates/base_auth.html

templates/login.html → pydash/templates/login.html

templates/logout.html → pydash/templates/logout.html

templates/main.html → pydash/templates/main.html

46
pydash/urls.py

@ -1,35 +1,21 @@
from django.conf.urls import patterns, url
from django.conf import settings
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'pydash.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
# url(r'^admin/', include(admin.site.urls)),
url(r'^$', 'main.views.index', name='index'),
url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'},
url(r'^$', 'pydash.views.index', name='index'),
url(r'login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'},
name='login'),
url(r'^logout/$', 'django.contrib.auth.views.logout', {'template_name': 'logout.html'},
url(r'logout/$', 'django.contrib.auth.views.logout', {'template_name': 'logout.html'},
name='logout'),
url(r'^main/$', 'main.views.getall', name='main'),
url(r'^info/uptime/$', 'usage.views.uptime', name='uptime'),
url(r'^info/memory/$', 'usage.views.memusage', name='memusage'),
url(r'^info/cpuusage/$', 'usage.views.cpuusage', name='cpuusage'),
url(r'^info/getdisk/$', 'usage.views.getdisk', name='getdisk'),
url(r'^info/getusers/$', 'usage.views.getusers', name='getusers'),
url(r'^info/getips/$', 'usage.views.getips', name='getips'),
url(r'^info/gettraffic/$', 'usage.views.gettraffic', name='gettraffic'),
url(r'^info/proc/$', 'usage.views.getproc', name='getproc'),
url(r'^info/getdiskio/$', 'usage.views.getdiskio', name='getdiskio'),
url(r'^info/loadaverage/$', 'usage.views.loadaverage', name='loadaverage'),
url(r'^info/platform/([\w\-\.]+)/$', 'usage.views.platform', name='platform'),
url(r'^info/getcpus/([\w\-\.]+)/$', 'usage.views.getcpus', name='getcpus'),
url(r'^info/getnetstat/$', 'usage.views.getnetstat', name='getnetstat'))
urlpatterns += patterns('',
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.STATIC_ROOT}))
url(r'info/uptime/$', 'pydash.views.uptime', name='uptime'),
url(r'info/memory/$', 'pydash.views.memusage', name='memusage'),
url(r'info/cpuusage/$', 'pydash.views.cpuusage', name='cpuusage'),
url(r'info/getdisk/$', 'pydash.views.getdisk', name='getdisk'),
url(r'info/getusers/$', 'pydash.views.getusers', name='getusers'),
url(r'info/getips/$', 'pydash.views.getips', name='getips'),
url(r'info/gettraffic/$', 'pydash.views.gettraffic', name='gettraffic'),
url(r'info/proc/$', 'pydash.views.getproc', name='getproc'),
url(r'info/getdiskio/$', 'pydash.views.getdiskio', name='getdiskio'),
url(r'info/loadaverage/$', 'pydash.views.loadaverage', name='loadaverage'),
url(r'info/platform/([\w\-\.]+)/$', 'pydash.views.platform', name='platform'),
url(r'info/getcpus/([\w\-\.]+)/$', 'pydash.views.getcpus', name='getcpus'),
url(r'info/getnetstat/$', 'pydash.views.getnetstat', name='getnetstat'))

usage/views.py → pydash/views.py

0
usage/__init__.py

Loading…
Cancel
Save