Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e86ea3eb
authored
Sep 05, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pep8 fixes
parent
8dfd6606
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
44 additions
and
40 deletions
+44
-40
circle/circle/settings/base.py
+12
-11
circle/circle/settings/local.py
+12
-10
circle/circle/settings/production.py
+9
-10
circle/circle/urls.py
+3
-2
circle/circle/wsgi.py
+1
-0
circle/dashboard/urls.py
+5
-4
circle/dashboard/views.py
+2
-2
circle/storage/models.py
+0
-1
No files found.
circle/circle/settings/base.py
View file @
e86ea3eb
...
...
@@ -4,13 +4,14 @@
from
os
import
environ
from
os.path
import
abspath
,
basename
,
dirname
,
join
,
normpath
from
json
import
loads
from
socket
import
SOCK_STREAM
#
from socket import SOCK_STREAM
from
sys
import
path
# Normally you should not import ANYTHING from Django directly
# into your settings, but ImproperlyConfigured is an exception.
from
django.core.exceptions
import
ImproperlyConfigured
def
get_env_variable
(
var_name
,
default
=
None
):
""" Get the environment variable or return exception/default """
try
:
...
...
@@ -64,7 +65,7 @@ MANAGERS = ADMINS
DATABASES
=
{
'default'
:
{
'ENGINE'
:
'django.db.backends.'
+
get_env_variable
(
'DJANG_DB_TYPE'
,
'postgresql_psycopg2'
),
get_env_variable
(
'DJANG_DB_TYPE'
,
'postgresql_psycopg2'
),
'NAME'
:
get_env_variable
(
'DJANGO_DB_NAME'
,
'circle'
),
'USER'
:
get_env_variable
(
'DJANGO_DB_USER'
,
'circle'
),
'PASSWORD'
:
get_env_variable
(
'DJANGO_DB_PASSWORD'
),
...
...
@@ -79,7 +80,7 @@ DATABASES = {
# See: https://docs.djangoproject.com/en/dev/ref/settings/#time-zone
try
:
with
open
(
"/etc/timezone"
,
"r"
)
as
f
:
systz
=
f
.
readline
()
.
rstrip
()
systz
=
f
.
readline
()
.
rstrip
()
except
:
systz
=
None
...
...
@@ -247,7 +248,7 @@ INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
LOGGING
=
{
'version'
:
1
,
'disable_existing_loggers'
:
False
,
'formatters'
:{
'formatters'
:
{
'simple'
:
{
'format'
:
'
%(asctime)
s [
%(levelname)
s]:
%(name)
s
%(message)
s'
,
'datefmt'
:
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
,
...
...
@@ -264,14 +265,14 @@ LOGGING = {
'filters'
:
[
'require_debug_false'
],
'class'
:
'django.utils.log.AdminEmailHandler'
},
'syslog'
:
{
'level'
:
'INFO'
,
'class'
:
'logging.handlers.SysLogHandler'
,
'syslog'
:
{
'level'
:
'INFO'
,
'class'
:
'logging.handlers.SysLogHandler'
,
'formatter'
:
'simple'
,
'address'
:
'/dev/log'
,
# 'socktype': SOCK_STREAM,
# 'address': ('host', '514'),
}
'address'
:
'/dev/log'
,
# 'socktype': SOCK_STREAM,
# 'address': ('host', '514'),
}
},
'loggers'
:
{
'django.request'
:
{
...
...
circle/circle/settings/local.py
View file @
e86ea3eb
"""Development settings and globals."""
from
os.path
import
join
,
normpath
#
from os.path import join, normpath
from
base
import
*
...
...
@@ -47,23 +47,25 @@ CACHES = {
########## TOOLBAR CONFIGURATION
#
See:
https://github.com/django-debug-toolbar/django-debug-toolbar#installation
# https://github.com/django-debug-toolbar/django-debug-toolbar#installation
if
get_env_variable
(
'DJANGO_TOOLBAR'
,
'FALSE'
)
==
'TRUE'
:
INSTALLED_APPS
+=
(
'debug_toolbar'
,
'debug_toolbar'
,
)
# See: https://github.com/django-debug-toolbar/django-debug-toolbar#installation
INTERNAL_IPS
=
(
get_env_variable
(
'SSH_CLIENT'
,
'127.0.0.1'
)
.
split
(
' '
)[
0
],
)
# https://github.com/django-debug-toolbar/django-debug-toolbar#installation
INTERNAL_IPS
=
(
get_env_variable
(
'SSH_CLIENT'
,
'127.0.0.1'
)
.
split
(
' '
)[
0
],
)
#
See:
https://github.com/django-debug-toolbar/django-debug-toolbar#installation
# https://github.com/django-debug-toolbar/django-debug-toolbar#installation
MIDDLEWARE_CLASSES
+=
(
'debug_toolbar.middleware.DebugToolbarMiddleware'
,
'debug_toolbar.middleware.DebugToolbarMiddleware'
,
)
#
See:
https://github.com/django-debug-toolbar/django-debug-toolbar#installation
# https://github.com/django-debug-toolbar/django-debug-toolbar#installation
DEBUG_TOOLBAR_CONFIG
=
{
'INTERCEPT_REDIRECTS'
:
False
,
'SHOW_TEMPLATE_CONTEXT'
:
True
,
'INTERCEPT_REDIRECTS'
:
False
,
'SHOW_TEMPLATE_CONTEXT'
:
True
,
}
########## END TOOLBAR CONFIGURATION
circle/circle/settings/production.py
View file @
e86ea3eb
...
...
@@ -29,7 +29,7 @@ try:
except
ImproperlyConfigured
:
pass
else
:
#
See:
https://docs.djangoproject.com/en/dev/ref/settings/#email-host-password
# https://docs.djangoproject.com/en/dev/ref/settings/#email-host-password
EMAIL_HOST_PASSWORD
=
environ
.
get
(
'EMAIL_HOST_PASSWORD'
,
''
)
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host-user
...
...
@@ -49,22 +49,21 @@ SERVER_EMAIL = EMAIL_HOST_USER
########## END EMAIL CONFIGURATION
########## CACHE CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#caches
try
:
CACHES
=
{
'default'
:
{
'BACKEND'
:
'django.core.cache.backends.memcached.MemcachedCache'
,
'LOCATION'
:
get_env_variable
(
'DJANGO_MEMCACHED'
),
}
'default'
:
{
'BACKEND'
:
'django.core.cache.backends.memcached.MemcachedCache'
,
'LOCATION'
:
get_env_variable
(
'DJANGO_MEMCACHED'
),
}
}
except
ImproperlyConfigured
:
CACHES
=
{
'default'
:
{
'BACKEND'
:
'django.core.cache.backends.locmem.LocMemCache'
,
'LOCATION'
:
SITE_NAME
,
}
'default'
:
{
'BACKEND'
:
'django.core.cache.backends.locmem.LocMemCache'
,
'LOCATION'
:
SITE_NAME
,
}
}
########## END CACHE CONFIGURATION
...
...
circle/circle/urls.py
View file @
e86ea3eb
from
django.conf.urls
import
patterns
,
include
,
url
from
django.views.generic
import
TemplateView
#
from django.views.generic import TemplateView
from
django.contrib
import
admin
admin
.
autodiscover
()
urlpatterns
=
patterns
(
''
,
urlpatterns
=
patterns
(
''
,
#url(r'^$', TemplateView.as_view(template_name='base.html')),
# Examples:
...
...
circle/circle/wsgi.py
View file @
e86ea3eb
...
...
@@ -33,6 +33,7 @@ from django.core.wsgi import get_wsgi_application
_application
=
get_wsgi_application
()
def
application
(
environ
,
start_response
):
# copy DJANGO_* wsgi-env vars to process-env
for
i
in
environ
.
keys
():
...
...
circle/dashboard/urls.py
View file @
e86ea3eb
from
django.conf.urls
import
patterns
,
include
,
url
from
django.conf.urls
import
patterns
,
url
from
.views
import
IndexView
,
VmDetailView
urlpatterns
=
patterns
(
''
,
url
(
r'^$'
,
IndexView
.
as_view
()),
url
(
r'^vm/\d+/$'
,
VmDetailView
.
as_view
()),
urlpatterns
=
patterns
(
''
,
url
(
r'^$'
,
IndexView
.
as_view
()),
url
(
r'^vm/\d+/$'
,
VmDetailView
.
as_view
()),
)
circle/dashboard/views.py
View file @
e86ea3eb
...
...
@@ -2,8 +2,8 @@ from django.views.generic import TemplateView
class
IndexView
(
TemplateView
):
template_name
=
"dashboard/index.html"
template_name
=
"dashboard/index.html"
class
VmDetailView
(
TemplateView
):
template_name
=
"dashboard/vm-detail.html"
template_name
=
"dashboard/vm-detail.html"
circle/storage/models.py
View file @
e86ea3eb
...
...
@@ -76,7 +76,6 @@ class Disk(TimeStampedModel):
'target_device'
:
self
.
device_type
+
self
.
dev_num
}
def
to_json
(
self
):
self
.
base_name
=
self
.
base
.
name
if
self
.
base
else
None
self
.
dir
=
self
.
datastore
.
path
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment