django-wsgi

apache server not using proper virtualenv with WSGI setting

旧街凉风 提交于 2019-12-10 11:27:46
问题 I am facing a problem related to django wsgi script. I have been using two virtualenv for my two application and I have deployed these two application on my local server with different port. Apache configuration file for first Appplication looks like: listen 8081 WSGIPythonPath /home/user/app1:/home/user/virtual-env1/lib/python2.7/site-packages <VirtualHost mylocalip:8081> ServerAdmin webmaster@localhost ServerName www.app1.com DocumentRoot /home/user/app1 <Directory /home/user/app1/static

gzip not working in Django with Whitenoise

泄露秘密 提交于 2019-12-08 19:23:08
问题 I have a Django website deployed on Heroku, using Whitenoise for serving static files. The static files work fine but Gzip is not working according to various websites that I used to test it (including google tools). this is the code in my production settings files: DATABASES['default'] = dj_database_url.config() SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') ALLOWED_HOSTS = ['*'] STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage' My static files

Configuring WSGI to service a single index.html file for a single page application

北城以北 提交于 2019-12-08 12:25:04
问题 I have a standard Django application set up using WSGI on Apache2 (Ubuntu 18.04) I now want to serve all front end content via a single index.html file (still allowing access the /admin url and ensuring the REST api calls via /api work). I'm using Ember for the single page application. Any help much appreciated! Here is my current .conf set up: DocumentRoot /var/www/examplesite.co.uk/public_html Alias /static /home/someuser/djangoprojects/someuser_v1_project/static <Directory /home/someuser

Baffled: Django “could not import app.views” but can import app, in WSGI?

帅比萌擦擦* 提交于 2019-12-06 11:49:43
问题 I'm having an odd Django problem, running Django with mod_wsgi. Django is finding urls.py , and then saying: ViewDoesNotExist: Could not import app.views. Error was: No module named views Bizarrely, if I have import app in the import statements in urls.py I don't get an error (until it hits app.views as above), but if I have from app import views in my import statements, I get an error. My python path, as shown in the Django debug info, has both the containing folder and the app folder on it.

Why do we have to provide WSGI_APPLICATION variable in Django settings

北战南征 提交于 2019-12-06 03:25:09
问题 I'm a beginner Django developer so if this question doesn't make sense please forgive me. We provide a variable called WSGI_APPLICATION in django settings along with ROOT_URLCONF and some other settings variables. and we provide settings file path in wsgi.py file as well, import os import django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGSS_MODULE", "<settings_file_path>") application = get_wsgi_application() So you see, its a two way connection.right? I mean

Django sys.path.append for project *and* app needed under WSGI

孤街醉人 提交于 2019-12-06 02:05:35
问题 Could somebody give me a pointer on why I need to add my project root path to the python path as well as the application itself in my WSGI file? Project base is called 'djapp', the application is called 'myapp'. sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..') sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../djapp') os.environ['DJANGO_SETTINGS_MODULE'] = 'djapp.settings' If I omit the line with "/../djapp/" the log tells my that 'myapp' can not be imported,

uwsgi options --wsgi-file and --module not recognized

烈酒焚心 提交于 2019-12-04 16:47:56
问题 I am trying to run a Django app using uwsgi. Most instructions I have found refer to a "--wsgi-file" and "--module" to specify the application, but "uwsgi" makes no mention of these options, and when I try and use them: uwsgi -s /tmp/uwsgi.sock --master --module myapp.wsgi uwsgi: unrecognized option '--module' getopt_long() error And uwsgi -s /tmp/uwsgi.sock --master --wsgi-file myapp/wsgi.py uwsgi: unrecognized option '--wsgi-file' getopt_long() error When I run it without either, I get:

Why do we have to provide WSGI_APPLICATION variable in Django settings

十年热恋 提交于 2019-12-04 10:09:26
I'm a beginner Django developer so if this question doesn't make sense please forgive me. We provide a variable called WSGI_APPLICATION in django settings along with ROOT_URLCONF and some other settings variables. and we provide settings file path in wsgi.py file as well, import os import django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGSS_MODULE", "<settings_file_path>") application = get_wsgi_application() So you see, its a two way connection.right? I mean path of settings file in wsgi file and path of wsgi file in settings file. so why do we have to do this.

What is the best way to run Django on Tornado Web Server to have async + django admin + django orm possibilities?

随声附和 提交于 2019-12-03 10:43:02
问题 I would like to have django admin panel with tornado backends, which will process requests from online game. I dont know at the moment, is it a good idea to load django app in the next way: wsgi_app = tornado.wsgi.WSGIContainer( django.core.handlers.wsgi.WSGIHandler()) tornado_app = tornado.web.Application( [ ('/hello-tornado', HelloHandler), ('.*', tornado.web.FallbackHandler, dict(fallback=wsgi_app)), ]) server = tornado.httpserver.HTTPServer(tornado_app) server.listen(options.port) tornado

uwsgi options --wsgi-file and --module not recognized

瘦欲@ 提交于 2019-12-03 09:53:30
I am trying to run a Django app using uwsgi. Most instructions I have found refer to a "--wsgi-file" and "--module" to specify the application, but "uwsgi" makes no mention of these options, and when I try and use them: uwsgi -s /tmp/uwsgi.sock --master --module myapp.wsgi uwsgi: unrecognized option '--module' getopt_long() error And uwsgi -s /tmp/uwsgi.sock --master --wsgi-file myapp/wsgi.py uwsgi: unrecognized option '--wsgi-file' getopt_long() error When I run it without either, I get: uwsgi -s /tmp/uwsgi.sock --master *** Starting uWSGI 2.0.9 (64bit) on [Fri Jul 10 11:12:04 2015] ***