added (example) activate_this.py
This commit is contained in:
14
README.md
14
README.md
@@ -7,15 +7,15 @@
|
|||||||
|
|
||||||
```xml
|
```xml
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName vue-test
|
ServerName lrc
|
||||||
ServerAlias vue-test.local
|
ServerAlias lrc.local
|
||||||
ServerAdmin kurze@kit.edu
|
ServerAdmin kurze@kit.edu
|
||||||
ErrorLog "/var/log/httpd/vue-test.local-error_log"
|
ErrorLog "/var/log/httpd/lrc.local-error_log"
|
||||||
CustomLog "/var/log/httpd/vue-test.local-access_log" common
|
CustomLog "/var/log/httpd/lrc.local-access_log" common
|
||||||
|
|
||||||
DocumentRoot /srv/http/vue_test/
|
DocumentRoot /srv/http/lrc/
|
||||||
WSGIScriptAlias / /srv/http/vue_test/app.wsgi
|
WSGIScriptAlias / /srv/http/lrc/app.wsgi
|
||||||
<Directory "/srv/http/vue_test/">
|
<Directory "/srv/http/lrc/">
|
||||||
Allow from all
|
Allow from all
|
||||||
</Directory>
|
</Directory>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|||||||
34
activate_this.py
Normal file
34
activate_this.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
"""By using execfile(this_file, dict(__file__=this_file)) you will
|
||||||
|
activate this virtualenv environment.
|
||||||
|
|
||||||
|
This can be used when you must use an existing Python interpreter, not
|
||||||
|
the virtualenv bin/python
|
||||||
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
__file__
|
||||||
|
except NameError:
|
||||||
|
raise AssertionError(
|
||||||
|
"You must run this like execfile('path/to/activate_this.py', dict(__file__='path/to/activate_this.py'))")
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
old_os_path = os.environ.get('PATH', '')
|
||||||
|
os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + os.pathsep + old_os_path
|
||||||
|
base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
site_packages = os.path.join(base, 'Lib', 'site-packages')
|
||||||
|
else:
|
||||||
|
site_packages = os.path.join(base, 'lib', 'python%s' % sys.version[:3], 'site-packages')
|
||||||
|
prev_sys_path = list(sys.path)
|
||||||
|
import site
|
||||||
|
site.addsitedir(site_packages)
|
||||||
|
sys.real_prefix = sys.prefix
|
||||||
|
sys.prefix = base
|
||||||
|
# Move the added items to the front of the path:
|
||||||
|
new_sys_path = []
|
||||||
|
for item in list(sys.path):
|
||||||
|
if item not in prev_sys_path:
|
||||||
|
new_sys_path.append(item)
|
||||||
|
sys.path.remove(item)
|
||||||
|
sys.path[:0] = new_sys_path
|
||||||
4
app.wsgi
4
app.wsgi
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
activate_this = '/srv/http/vue_test/venv/bin/activate_this.py'
|
activate_this = '/srv/http/lrc/venv/bin/activate_this.py'
|
||||||
with open(activate_this) as file_:
|
with open(activate_this) as file_:
|
||||||
exec(file_.read(), dict(__file__=activate_this))
|
exec(file_.read(), dict(__file__=activate_this))
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ import sys
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
logging.basicConfig(stream=sys.stderr)
|
logging.basicConfig(stream=sys.stderr)
|
||||||
sys.path.insert(0, "/srv/http/vue_test/")
|
sys.path.insert(0, "/srv/http/lrc/")
|
||||||
|
|
||||||
from backend import app as application
|
from backend import app as application
|
||||||
application.secret_key = 'Add your secret key'
|
application.secret_key = 'Add your secret key'
|
||||||
|
|||||||
Reference in New Issue
Block a user