Skip to content

Commit

Permalink
deploy site
Browse files Browse the repository at this point in the history
  • Loading branch information
78 committed May 10, 2015
1 parent f0b5f47 commit 05d089a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ssbc/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
SECRET_KEY = 'fvewrf=&i9mjawldfkbxt%(oqi%3g1s=18o+n*5b-t4-k&-o=e'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = False

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['www.shousibaocai.com']


# Application definition
Expand Down
2 changes: 2 additions & 0 deletions uwsgi_api.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
uwsgi --socket /tmp/ssbc_api.sock --http :8001 --chmod-socket=666 -w ssbc.wsgi --processes 2 --threads 10 --thunder-lock --stats 127.0.0.1:9191 -R 5000 --disable-logging -M
2 changes: 2 additions & 0 deletions uwsgi_ssbc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
uwsgi --socket /tmp/ssbc_www1.sock --http :8002 --chmod-socket=666 -w ssbc.wsgi --processes 2 --threads 20 --thunder-lock --stats 127.0.0.1:9192 -R 5000 --disable-logging -M
9 changes: 5 additions & 4 deletions web/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from django.http import Http404
from django.shortcuts import render, redirect

API_URL = 'http://127.0.0.1:8000/api/'
API_URL = 'http://127.0.0.1:8001/api/'
API_HOST = 'www.shousibaocai.com'
re_punctuations = re.compile(
u"。|,|,|!|…|!|《|》|<|>|\"|'|:|:|?|\?|、|\||“|”|‘|’|;|—|(|)|·|\(|\)| |\.|【|】|『|』|@|&|%|\^|\*|\+|\||<|>|~|`|\[|\]")

Expand All @@ -22,7 +23,7 @@ def hash(request, h):
'hashes': h,
}
url = API_URL + 'json_info?' + urllib.urlencode(qs)
r = requests.get(url)
r = requests.get(url, headers={'Host':API_HOST})
try:
j = r.json()
except:
Expand Down Expand Up @@ -53,7 +54,7 @@ def search(request, keyword, p):
'start': d['offset'],
}
url = API_URL + 'json_search?' + urllib.urlencode(qs)
r = requests.get(url)
r = requests.get(url, headers={'Host':API_HOST})
d.update(r.json())
# Fill info
ids = '-'.join([str(x['id']) for x in d['result']['items']])
Expand All @@ -62,7 +63,7 @@ def search(request, keyword, p):
'hashes': ids,
}
url = API_URL + 'json_info?' + urllib.urlencode(qs)
r = requests.get(url)
r = requests.get(url, headers={'Host':API_HOST})
j = r.json()

for x in d['result']['items']:
Expand Down

0 comments on commit 05d089a

Please sign in to comment.