Commits

John Costa committed b3c2006

full rework

  • Participants
  • Parent commits 6300df8

Comments (0)

Files changed (23)

-*.pyc
-
-.dotcloud
 .idea
+.dotcloud
+*.pyc
 Django on DotCloud
 ==================
 
+   THIS IS A WORK IN PROGRESS AND NOT A COMPLETE SOLUTION
+
 This code shows how to run a very simple Django application on DotCloud.
 It is fully functional, in the sense that you don't have any hand-editing
 to do to deploy it: it automatically deploys a PostgreSQL database,
 <http://docs.dotcloud.com/>`_, especially the one for the `Python service
 <http://docs.dotcloud.com/services/python/>`_ which is used by this app.
 
-Notes:
-
-python manage.py runserver_socketio --settings=settings.local
-http://localhost:9000/chat
-
-
-gunicorn wsgi:application -c gunicorn.config --settings=/Users/jcosta/projects/django-on-dotcloud/hellodjango/settings/local.py
-
-
-gunicorn wsgi_ws:application --settings=/Users/jcosta/projects/django-on-dotcloud/hellodjango/settingsocal.py --error-log='/tmp/gunicorn.log' --worker-class geventwebsocket.gunicorn.workers.GeventWebSocketWorker --bind="127.0.0.1:5000"
-gunicorn wsgi:application --settings=/Users/jcosta/projects/django-on-dotcloud/hellodjango/settings/local.py --error-log='/tmp/gunicorn.log' --worker-class geventwebsocket.gunicorn.workers.GeventWebSocketWorker --bind='127.0.0.1:8000'
+import os
+import time
+
 import MySQLdb
 import psycopg2
-import os
+import _mysql_exceptions
 from wsgi import *
 
 def create_dbs():
-    print("create_dbs: let's go.")
-    django_settings = __import__(os.environ['DJANGO_SETTINGS_MODULE'], fromlist='DATABASES')
-    print("create_dbs: got settings.")
-    databases = django_settings.DATABASES
-    for name, db in databases.iteritems():
-        host = db['HOST']
-        user = db['USER']
-        password = db['PASSWORD']
-        port = db['PORT']
-        db_name = db['NAME']
-        db_type = db['ENGINE']
-        # see if it is mysql
-        if db_type.endswith('mysql'):
-            print 'creating database %s on %s' % (db_name, host)
-            db = MySQLdb.connect(user=user,
-                                passwd=password,
-                                host=host,
-                                port=port)
-            cur = db.cursor()
-            print("Check if database is already there.")
-            cur.execute("""SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA 
-                         WHERE SCHEMA_NAME = %s""", (db_name,))
-            results = cur.fetchone()
-            if not results:
-                print("Database %s doesn't exist, lets create it." % db_name)
-                sql = """CREATE DATABASE IF NOT EXISTS %s """ % (db_name,)
-                print("> %s" % sql)
-                cur.execute(sql)
-                print(".....")
-            else:
-                print("database already exists, moving on to next step.")
-        # see if it is postgresql
-        elif db_type.endswith('postgresql_psycopg2'):
-            print 'creating database %s on %s' % (db_name, host)
-            con = psycopg2.connect(host=host, user=user, password=password, port=port, database='postgres')
-            con.set_isolation_level(0)
-            cur = con.cursor()
-            try:
-                cur.execute('CREATE DATABASE %s' % db_name)
-            except psycopg2.ProgrammingError as detail:
-                print detail
-                print 'moving right along...'
-        else:
-            print("ERROR: {0} is not supported by this script, you will need to create your database by hand.".format(db_type))
+    deadline = time.time() + 60
+    while time.time() < deadline:
+        try:
+            print("create_dbs: let's go.")
+            django_settings = __import__(os.environ['DJANGO_SETTINGS_MODULE'], fromlist='DATABASES')
+            print("create_dbs: got settings.")
+            databases = django_settings.DATABASES
+            for name, db in databases.iteritems():
+                host = db['HOST']
+                user = db['USER']
+                password = db['PASSWORD']
+                port = db['PORT']
+                db_name = db['NAME']
+                db_type = db['ENGINE']
+                # see if it is mysql
+                if db_type.endswith('mysql'):
+                    print 'creating database %s on %s' % (db_name, host)
+                    db = MySQLdb.connect(user=user,
+                                        passwd=password,
+                                        host=host,
+                                        port=port)
+                    cur = db.cursor()
+                    print("Check if database is already there.")
+                    cur.execute("""SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA
+                                 WHERE SCHEMA_NAME = %s""", (db_name,))
+                    results = cur.fetchone()
+                    if not results:
+                        print("Database %s doesn't exist, lets create it." % db_name)
+                        sql = """CREATE DATABASE IF NOT EXISTS %s """ % (db_name,)
+                        print("> %s" % sql)
+                        cur.execute(sql)
+                        print(".....")
+                    else:
+                        print("database already exists, moving on to next step.")
+                    exit(0)
+                # see if it is postgresql
+                elif db_type.endswith('postgresql_psycopg2'):
+                    print 'creating database %s on %s' % (db_name, host)
+                    con = psycopg2.connect(host=host, user=user, password=password, port=port, database='postgres')
+                    con.set_isolation_level(0)
+                    cur = con.cursor()
+                    try:
+                        cur.execute('CREATE DATABASE %s' % db_name)
+                    except psycopg2.ProgrammingError as detail:
+                        print detail
+                        print 'moving right along...'
+                    exit(0)
+                else:
+                    print("ERROR: {0} is not supported by this script, you will need to create your database by hand.".format(db_type))
+                    exit(1)
+        except psycopg2.OperationalError:
+            print "Could not connect to database. Waiting a little bit."
+            time.sleep(10)
+        except _mysql_exceptions.OperationalError:
+            print "Could not connect to database. Waiting a little bit."
+            time.sleep(10)
+
 
+    print 'Could not connect to database after 1 minutes. Something is wrong.'
+    exit(1)
 
 if __name__ == '__main__':
     import sys

File dotcloud.yml

 www:
-  type: python-worker
-  ports:
-      www: http
+  type: python
+  systempackages:
+    - libevent-dev
+    - python-all-dev
 db:
-  type: mysql
+  type: postgresql
 cache:
-  type: redis
+  type: redis

File gunicorn.conf

-import json
-with open('/home/dotcloud/environment.json') as f:
-    env = json.load(f)
-
-
-workers = 2
+workers = 1
 worker_class = 'geventwebsocket.gunicorn.workers.GeventWebSocketWorker'
-bind = "127.0.0.1:{0}".format(env['PORT_WWW'])
 pidfile = '/tmp/gunicorn.pid'
 debug = True
 loglevel = 'debug'
-errorlog = '/tmp/gunicorn.log'
-#daemon = True
-django_settings='/Users/jcosta/projects/django-on-dotcloud/hellodjango/settings/dotcloud.py'
+errorlog = '/var/log/supervisor/gunicorn.log'
+daemon = True
+django_settings='/home/dotcloud/current/hellodjango/settings.py'
+timeout=30
+bind = "127.0.0.1:{0}".format(5000)

File gunicorn_ws.conf

-workers = 2
-worker_class = 'geventwebsocket.gunicorn.workers.GeventWebSocketWorker'
-bind = '127.0.0.1:5000'
-pidfile = '/tmp/gunicorn_ws.pid'
-debug = True
-loglevel = 'debug'
-errorlog = '/tmp/gunicorn.log'
-daemon = True
-django_settings='/Users/jcosta/projects/django-on-dotcloud/hellodjango/settings/dotcloud.py'

File hellodjango/helloapp/__init__.py

Empty file removed.

File hellodjango/helloapp/models.py

-from django.db import models
-
-# Create your models here.

File hellodjango/helloapp/tests.py

-"""
-This file demonstrates writing tests using the unittest module. These will pass
-when you run "manage.py test".
-
-Replace this with more appropriate tests for your application.
-"""
-
-from django.test import TestCase
-
-
-class SimpleTest(TestCase):
-    def test_basic_addition(self):
-        """
-        Tests that 1 + 1 always equals 2.
-        """
-        self.assertEqual(1 + 1, 2)

File hellodjango/helloapp/views.py

-from django.template import Context, loader
-from datetime import datetime
-from django.http import HttpResponse
-
-def hello_view(request):
-    """ Simple Hello World View """
-    t = loader.get_template('helloworld.html')
-    c = Context({
-        'current_time': datetime.now(),
-    })
-    return HttpResponse(t.render(c))

File hellodjango/settings.py

+# Django settings for hellodjango project.
+import os
+
+import json
+with open('/home/dotcloud/environment.json') as f:
+  env = json.load(f)
+
+settings_dir = os.path.dirname(__file__)
+PROJECT_ROOT = os.path.abspath(os.path.dirname(settings_dir))
+
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+
+ADMINS = (
+    # ('Your Name', 'your_email@example.com'),
+)
+
+MANAGERS = ADMINS
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.postgresql_psycopg2',
+        'NAME': 'happydb',
+        'USER': env['DOTCLOUD_DB_SQL_LOGIN'],
+        'PASSWORD': env['DOTCLOUD_DB_SQL_PASSWORD'],
+        'HOST': env['DOTCLOUD_DB_SQL_HOST'],
+        'PORT': int(env['DOTCLOUD_DB_SQL_PORT']),
+    }
+}
+
+# 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.
+# 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'
+
+# 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
+
+# Absolute filesystem path to the directory that will hold user-uploaded files.
+# Example: "/home/media/media.lawrence.com/media/"
+MEDIA_ROOT = '/home/dotcloud/data/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 = '/home/dotcloud/volatile/static/'
+
+# URL prefix for static files.
+# Example: "http://media.lawrence.com/static/"
+STATIC_URL = '/static/'
+
+# Additional locations of static files
+STATICFILES_DIRS = (
+    os.path.join(PROJECT_ROOT, 'static/'),
+)
+
+# 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 = '@ei90c#1l730c5ru0*2$1zuqr90^fy3_4(wyys&^3ojqqytkwy'
+
+# 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.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.csrf.CsrfViewMiddleware',
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
+    'django.contrib.messages.middleware.MessageMiddleware',
+)
+
+ROOT_URLCONF = 'hellodjango.urls'
+
+TEMPLATE_DIRS = (
+    os.path.join(PROJECT_ROOT, 'hellodjango/templates/'),
+)
+
+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_socketio',
+    'chat',
+)
+
+# 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 http://docs.djangoproject.com/en/dev/topics/logging for
+# more details on how to customize your logging configuration.
+LOGGING = {
+    'version': 1,
+    'disable_existing_loggers': True,
+    'formatters': {
+        'verbose': {
+            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
+        },
+        'simple': {
+            'format': '%(levelname)s %(message)s'
+        },
+    },
+    'handlers': {
+        'null': {
+            'level':'DEBUG',
+            'class':'django.utils.log.NullHandler',
+        },
+        'console': {
+            'level': 'DEBUG',
+            'class': 'logging.StreamHandler',
+            'formatter': 'verbose'
+        },
+        'log_file': {
+            'level': 'DEBUG',
+            'class': 'logging.handlers.RotatingFileHandler',
+            'formatter': 'verbose',
+            'filename': '/var/log/supervisor/blogapp.log',
+            'maxBytes': 1024*1024*25, # 25 MB
+            'backupCount': 5,
+        },
+        'mail_admins': {
+            'level': 'ERROR',
+            'class': 'django.utils.log.AdminEmailHandler'
+        }
+    },
+    'loggers': {
+        'django': {
+            'handlers': ['console', 'log_file', 'mail_admins'],
+            'level': 'INFO',
+            'propagate': True,
+        },
+        'django.request': {
+            'handlers': ['console', 'log_file', 'mail_admins'],
+            'level': 'ERROR',
+            'propagate': False,
+        },
+        'django.db.backends': {
+            'handlers': ['console', 'log_file', 'mail_admins'],
+            'level': 'INFO',
+            'propagate': False,
+        },
+        # Catch All Logger -- Captures any other logging
+        '': {
+            'handlers': ['console', 'log_file', 'mail_admins'],
+            'level': 'INFO',
+            'propagate': True,
+        }
+    }
+}
+
+SOCKETIO_HOST = '127.0.0.1'
+SOCKETIO_PORT = '5000'

File hellodjango/settings/__init__.py

-import sys
-
-try:
-    if not "--settings" in ''.join(sys.argv):
-        from .dotcloud import *
-    else:
-        from .local import *
-except ImportError:
-    import sys
-    print ('Warning importing settings/dotcloud.py. Did you forget to '
-           'symlink your currentenv settings?')
-
-    import traceback
-    print traceback.print_exc()

File hellodjango/settings/base.py

-# Django settings for hellodjango project.
-import os
-
-settings_dir = os.path.dirname(__file__)
-PROJECT_ROOT = os.path.abspath(os.path.dirname(settings_dir))
-
-DEBUG = True
-TEMPLATE_DEBUG = DEBUG
-
-ADMINS = (
-# ('Your Name', 'your_email@example.com'),
-)
-
-MANAGERS = ADMINS
-
-# 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.
-# 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'
-
-# 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
-
-# Absolute filesystem path to the directory that will hold user-uploaded files.
-# Example: "/home/media/media.lawrence.com/media/"
-MEDIA_ROOT = '/home/dotcloud/data/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 = '/home/dotcloud/volatile/static/'
-
-# URL prefix for static files.
-# Example: "http://media.lawrence.com/static/"
-STATIC_URL = '/static/'
-
-# Additional locations of static files
-STATICFILES_DIRS = (
-    os.path.join(PROJECT_ROOT +"/../", 'static/'),
-    )
-
-# 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 = '@ei90c#1l730c5ru0*2$1zuqr90^fy3_4(wyys&^3ojqqytkwy'
-
-# 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.contrib.sessions.middleware.SessionMiddleware',
-    'django.middleware.csrf.CsrfViewMiddleware',
-    'django.contrib.auth.middleware.AuthenticationMiddleware',
-    'django.contrib.messages.middleware.MessageMiddleware',
-    )
-
-ROOT_URLCONF = 'hellodjango.urls'
-TEMPLATE_DIRS = (
-    os.path.join(PROJECT_ROOT+'/../', 'hellodjango/templates/'),
-    )
-
-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_socketio',
-    'helloapp',
-    'chat',
-    )
-
-# 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 http://docs.djangoproject.com/en/dev/topics/logging for
-# more details on how to customize your logging configuration.
-LOGGING = {
-    'version': 1,
-    'disable_existing_loggers': True,
-    'formatters': {
-        'verbose': {
-            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
-        },
-        'simple': {
-            'format': '%(levelname)s %(message)s'
-        },
-        },
-    'handlers': {
-        'null': {
-            'level':'DEBUG',
-            'class':'django.utils.log.NullHandler',
-            },
-        'console': {
-            'level': 'DEBUG',
-            'class': 'logging.StreamHandler',
-            'formatter': 'verbose'
-        },
-        'log_file': {
-            'level': 'DEBUG',
-            'class': 'logging.handlers.RotatingFileHandler',
-            'formatter': 'verbose',
-            'filename': '/var/log/supervisor/blogapp.log',
-            'maxBytes': 1024*1024*25, # 25 MB
-            'backupCount': 5,
-            },
-        'mail_admins': {
-            'level': 'ERROR',
-            'class': 'django.utils.log.AdminEmailHandler'
-        }
-    },
-    'loggers': {
-        'django': {
-            'handlers': ['console', 'log_file', 'mail_admins'],
-            'level': 'INFO',
-            'propagate': True,
-            },
-        'django.request': {
-            'handlers': ['console', 'log_file', 'mail_admins'],
-            'level': 'ERROR',
-            'propagate': False,
-            },
-        'django.db.backends': {
-            'handlers': ['console', 'log_file', 'mail_admins'],
-            'level': 'INFO',
-            'propagate': False,
-            },
-        # Catch All Logger -- Captures any other logging
-        '': {
-            'handlers': ['console', 'log_file', 'mail_admins'],
-            'level': 'DEBUG',
-            'propagate': True,
-            }
-    }
-}

File hellodjango/settings/dotcloud.py

-from .base import *
-
-import json
-with open('/home/dotcloud/environment.json') as f:
-    env = json.load(f)
-
-DATABASES = {
-    'default': {
-        'ENGINE': 'django.db.backends.mysql',
-        'NAME': 'happydb',
-        'USER': env['DOTCLOUD_DB_MYSQL_LOGIN'],
-        'PASSWORD': env['DOTCLOUD_DB_MYSQL_PASSWORD'],
-        'HOST': env['DOTCLOUD_DB_MYSQL_HOST'],
-        'PORT': int(env['DOTCLOUD_DB_MYSQL_PORT']),
-        }
-}
-
-SOCKETIO_HOST = '127.0.0.1'
-SOCKETIO_PORT = '9000'

File hellodjango/settings/local.py

-from .base import *
-
-DATABASES = {
-    'default': {
-        'ENGINE': 'django.db.backends.mysql',
-        'NAME': 'happydb',
-        'USER': 'happy_user',
-        'PASSWORD': 'happy_user',
-    }
-}
-
-LOGGING['handlers']['log_file']['filename'] = '/tmp/djwebsocket.log'
-
-SOCKETIO_HOST = '127.0.0.1'
-SOCKETIO_PORT = '9000'

File hellodjango/templates/helloworld.html

 <html>
 <head><title>Hello World!</title>
-
-<head>
-    {% load socketio_tags %}
-    {% socketio %}
-    <script>
-        var socket = new io.Socket();
-        socket.connect();
-        // etc
-    </script>
-</head>
-
-</head>
 <body>
     <p>Hello World. The current day and time is {{current_time|date:"DATETIME_FORMAT"}}.</p>
-
 </body>
 </html>

File hellodjango/urls.py

 from django.conf import settings
 from django.conf.urls.defaults import patterns, include, url
-# import the view from helloapp
-from helloapp.views import hello_view
+
 # Uncomment the next two lines to enable the admin:
 from django.contrib import admin
-
-
 admin.autodiscover()
 
 urlpatterns = patterns('',
-    url(r'^$', view=hello_view, name='hello_page'),
-    url("^chat/", include("chat.urls")),
+    ("^chat/", include('chat.urls')),
     url("", include('django_socketio.urls')),
     url(r'^admin/', include(admin.site.urls)),
 )
 if settings.DEBUG:
     urlpatterns += patterns('django.contrib.staticfiles.views',
         url(r'^static/(?P<path>.*)$', 'serve'),
-    )
+    )
 location /media/ { root /home/dotcloud/data ; }
 location /static/ { root /home/dotcloud/volatile ; }
+location /socket.io/xhr-polling/ { proxy_pass http://localhost:5000; }

File requirements.txt

 Django==1.3.1
 django-redis==1.4.5
 gunicorn
-django-socketio
+django-socketio

File supervisor.conf

+[program:websocket]
+command=/home/dotcloud/env/bin/python /home/dotcloud/env/bin/gunicorn wsgi_ws:application -c /home/dotcloud/current/gunicorn.conf

File supervisord.conf

-[program:webserver]
-command = gunicorn wsgi:application --settings=/home/dotcloud/current/hellodjango/settings/local.py -c /home/dotcloud/current/gunicorn.conf
-
-#[program:websocket]
-#command = gunicorn wsgi_ws:application --settings=/home/dotcloud/current/hellodjango/settings/local.py -c /home/dotcloud/current/gunicorn_ws.conf
 import os
 import sys
 
-PORT = 9000
-
 sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),'hellodjango')))
 os.environ['DJANGO_SETTINGS_MODULE'] = 'hellodjango.settings'
 import django.core.handlers.wsgi
 application = django.core.handlers.wsgi.WSGIHandler()
-
-#from socketio.server import SocketIOServer
-#
-##if __name__ == '__main__':
-#print 'Listening on port %s and on port 843 (flash policy server)' % PORT
-#SocketIOServer(('', PORT), application, resource="socket.io").serve_forever()
 
 from socketio.server import SocketIOServer
 
-PORT = 9000
+PORT = 8080
 
 sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),'hellodjango')))
 os.environ['DJANGO_SETTINGS_MODULE'] = 'hellodjango.settings'
 os.environ["DJANGO_SOCKETIO_PORT"] = str(PORT)
 
 
-bind = ('127.0.0.1', int(9000))
+bind = ('127.0.0.1', int(PORT))
 print
 print "SocketIOServer running on %s:%s" % bind
 print