update django files to Django 2

This commit is contained in:
catborise 2020-05-26 22:23:57 +03:00 committed by catborise
parent bf15de507a
commit 62f8ece0ef
3 changed files with 26 additions and 11 deletions

View File

@ -1,10 +1,21 @@
#!/usr/bin/env python3
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
if __name__ == "__main__":
os.environ["DJANGO_SETTINGS_MODULE"] = "webvirtcloud.settings"
from django.core.management import execute_from_command_line
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'webvirtcloud.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

View File

@ -8,7 +8,9 @@ https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
import os
os.environ["DJANGO_SETTINGS_MODULE"] = "webvirtcloud.settings"
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'webvirtcloud.settings')
application = get_wsgi_application()

View File

@ -6,15 +6,17 @@ It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
import os, sys
import os
import sys
from django.core.wsgi import get_wsgi_application
# execfile('/srv/webvirtcloud/venv/bin/activate_this.py', dict(__file__='/srv/webvvirtcloud/venv/bin/activate_this.py'))
exec(compile(open('/srv/webvirtcloud/venv/bin/activate_this.py', "rb").read(),
'/srv/webvirtcloud/venv/bin/activate_this.py', 'exec'))
# execfile('/srv/webvirtcloud/venv/bin/activate_this.py', dict(__file__='/srv/webvirtcloud/venv/bin/activate_this.py'))
exec(compile(open('/srv/webvirtcloud/venv/bin/activate', "rb").read(),
'/srv/webvirtcloud/venv/bin/activate', 'exec'))
sys.path.append('/srv/webvirtcloud')
os.environ["DJANGO_SETTINGS_MODULE"] = "webvirtcloud.settings"
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'webvirtcloud.settings')
application = get_wsgi_application()