Exemplo n.º 1
0
import sys, os

from twisted.web.wsgi import WSGIResource
from twisted.python.threadpool import ThreadPool
from twisted.internet import reactor
from django.core.handlers.wsgi import WSGIHandler
from twisted.application import internet, service, strports
from twisted.web import server, resource, static
from twisted.web.resource import ForbiddenResource

from path_settings import PROJECT_ROOT, VIRTUALENV, set_path
set_path()#Puts project and apps directories on path TODO: Turn this into a class and method.

from private import resources

from settings.production import PORT as PRODUCTION_SERVER_PORT
from settings.staging import PORT as STAGING_SERVER_PORT


class ThreadPoolService(service.Service):
    '''
    A simple class that defines a threadpool on init and provides for starting and stopping it.
    It's reasonable to question whether this class is necessary. :-)
    '''
    def __init__(self, pool):
        self.pool = pool

    def startService(self):
        service.Service.startService(self)
        self.pool.start()
Exemplo n.º 2
0
import subprocess
import sys, os

print "using python binary: %s" % sys.executable #For logging on iguanadon.

from path import path
from path_settings import set_path
set_path() #So that private is on path.

from private import resources

deployment_directory = path(__file__).abspath().dirname()

action = sys.argv[1]
deployment_type = sys.argv[2]

if deployment_type not in ['production', 'staging'] or action not in ['start', 'stop', 'restart']:
    exit('Usage: deploy.py (start / stop / restart) (production / staging)')

argument_details_tuple = deployment_directory, deployment_type

first_argument = '%s/%s.pid' % argument_details_tuple
second_argument = '%s/%s.tac' % argument_details_tuple

def start():
    subprocess.call(['twistd', '--pidfile', first_argument, '-y', second_argument, '--logfile', '%s/%s.log' % (resources.LOG_DIRECTORY, deployment_type)])

def stop():
    try:
        pid_file = open('%s/%s.pid' % argument_details_tuple)
        pid = pid_file.read()
Exemplo n.º 3
0
import os
os.environ["DJANGO_SETTINGS_MODULE"] = "settings.local"

from path_settings import set_path
set_path()

from django.contrib.auth.models import User
from django.core.management import ManagementUtility
from what_apps.mellon import config as mellon_config
from what_apps.do import config as do_config
from what_apps.slashroot import config as slashroot_config
from what_apps.people import config as people_config
from what_apps.contact import config as contact_config
from what_apps.comm import config as comm_config

utility = ManagementUtility(['', 'syncdb', '--noinput'])
utility.execute()

utility = ManagementUtility(['', 'migrate'])
utility.execute()

mellon_config.set_up()
do_config.set_up_privileges()
do_config.set_up()

slashroot_config.set_up()

admin = User.objects.get_or_create(username="******", is_superuser=True)[0]
admin.set_password('admin')
admin.save()
Exemplo n.º 4
0
import os
os.environ["DJANGO_SETTINGS_MODULE"] = "settings.local"

from path_settings import set_path
set_path()

from django.contrib.auth.models import User
from django.core.management import ManagementUtility
from what_apps.mellon import config as mellon_config
from what_apps.do import config as do_config
from what_apps.slashroot import config as slashroot_config
from what_apps.people import config as people_config
from what_apps.contact import config as contact_config
from what_apps.comm import config as comm_config

utility = ManagementUtility(['', 'syncdb', '--noinput'])
utility.execute()

utility = ManagementUtility(['', 'migrate'])
utility.execute()

mellon_config.set_up()
do_config.set_up_privileges()
do_config.set_up()

slashroot_config.set_up()

admin = User.objects.get_or_create(username="******", is_superuser=True)[0]
admin.set_password('admin')
admin.save()
Exemplo n.º 5
0
import sys, os

from twisted.web.wsgi import WSGIResource
from twisted.python.threadpool import ThreadPool
from twisted.internet import reactor
from django.core.handlers.wsgi import WSGIHandler
from twisted.application import internet, service, strports
from twisted.web import server, resource, static
from twisted.web.resource import ForbiddenResource

from path_settings import PROJECT_ROOT, VIRTUALENV, set_path
set_path()#Puts project and apps directories on path TODO: Turn this into a class and method.

from private import resources


class ThreadPoolService(service.Service):
    '''
    A simple class that defines a threadpool on init and provides for starting and stopping it.
    It's reasonable to question whether this class is necessary. :-)
    '''
    def __init__(self, pool):
        self.pool = pool

    def startService(self):
        service.Service.startService(self)
        self.pool.start()

    def stopService(self):
        service.Service.stopService(self)
        self.pool.stop()
Exemplo n.º 6
0
import subprocess
import sys, os

print "using python binary: %s" % sys.executable  #For logging on iguanadon.

from path import path
from path_settings import set_path
set_path()  #So that private is on path.

from private import resources

deployment_directory = path(__file__).abspath().dirname()

action = sys.argv[1]
deployment_type = sys.argv[2]

if deployment_type not in ['production', 'staging'
                           ] or action not in ['start', 'stop', 'restart']:
    exit('Usage: deploy.py (start / stop / restart) (production / staging)')

argument_details_tuple = deployment_directory, deployment_type

first_argument = '%s/%s.pid' % argument_details_tuple
second_argument = '%s/%s.tac' % argument_details_tuple


def start():
    subprocess.call([
        'twistd', '--pidfile', first_argument, '-y', second_argument,
        '--logfile',
        '%s/%s.log' % (resources.LOG_DIRECTORY, deployment_type)