Skip to content

Commit

Permalink
fix paths in specify panel.
Browse files Browse the repository at this point in the history
  • Loading branch information
benanhalt committed Jan 9, 2015
1 parent c36ddba commit 17b292a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
18 changes: 15 additions & 3 deletions specifypanel/specifypanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

SPECIFYWEB_DIR = path.abspath(path.join(path.dirname(__file__), '..'))
DB_MAP_FILE = path.join(SPECIFYWEB_DIR, 'db_map.json')
APACHE_CONF_FILE = path.join(SPECIFYWEB_DIR, 'specify_panel.conf')
VIRTHOST_WSGI = path.join(SPECIFYWEB_DIR, 'specify_virtual_host.wsgi')
PANEL_WSGI = path.join(SPECIFYWEB_DIR, 'specify_panel.wsgi')
REPORT_CONF_FILE = path.join(path.expanduser("~"), '.specify-report.properties')
APACHE_CONF_FILE = path.join(SPECIFYWEB_DIR, 'specifypanel_apache.conf')
VIRTHOST_WSGI = path.join(SPECIFYWEB_DIR, 'specifyweb_vh.wsgi')
PANEL_WSGI = path.join(SPECIFYWEB_DIR, 'specifypanel.wsgi')
MANAGE_PY = path.join(SPECIFYWEB_DIR, 'specifyweb', "manage.py")

MYSQL_USER = "-uMasterUser"
Expand Down Expand Up @@ -55,6 +56,16 @@ def set_dbs():
json.dump(db_map, f)

check_call(['/usr/bin/touch', VIRTHOST_WSGI])

with open(REPORT_CONF_FILE) as f:
report_conf_file = f.read()

dbname = db_map.get(SERVERS[0], None)
if dbname is not None:
with open(REPORT_CONF_FILE, 'w') as f:
report_conf_file = re.sub(r'^dbname=.*$', 'dbname=' + dbname, report_conf_file, flags=re.M)
f.write(report_conf_file)
check_call(['sudo', 'restart', 'specify-report-service'])
redirect('/')

@route('/upload/')
Expand Down Expand Up @@ -135,6 +146,7 @@ def github_hook():
"--work-tree=" + SPECIFYWEB_DIR,
"--git-dir=" + path.join(SPECIFYWEB_DIR, '.git'),
"pull"])
check_call(['/usr/bin/make', '-C', path.join(SPECIFYWEB_DIR, 'specifyweb')])
check_call(['/usr/bin/touch', VIRTHOST_WSGI])
check_call(['/usr/bin/touch', PANEL_WSGI])

Expand Down
6 changes: 3 additions & 3 deletions specifypanel_apache.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<Location /github_hook/>
Order Deny,Allow
Deny from all
Allow from all
Allow from 204.232.175.64/27
Allow from 192.30.252.0/22
</Location>
Expand All @@ -23,7 +23,7 @@
WSGIDaemonProcess panel user=anhalt group=anhalt
WSGIProcessGroup panel

WSGIScriptAlias / /home/anhalt/specifyweb/specify_panel.wsgi
WSGIScriptAlias / /home/anhalt/specifyweb/specifypanel.wsgi

ErrorLog /var/log/apache2/error.log

Expand All @@ -45,7 +45,7 @@
WSGIDaemonProcess $servername user=anhalt group=anhalt
WSGIProcessGroup $servername

WSGIScriptAlias / /home/anhalt/specifyweb/specify_virtual_host.wsgi
WSGIScriptAlias / /home/anhalt/specifyweb/specifyweb_vh.wsgi

ErrorLog /var/log/apache2/error.log

Expand Down
1 change: 0 additions & 1 deletion specifyweb_vh.wsgi
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'specifyweb.settings'
import django.core.handlers.wsgi
django_app = django.core.handlers.wsgi.WSGIHandler()


def application(environ, start_response):
server_name = environ['SERVER_NAME'].split('.')[0]
os.environ['SPECIFY_DATABASE_NAME'] = db_map[server_name]
Expand Down

0 comments on commit 17b292a

Please sign in to comment.