Discussion:
Issue with Python 3.6 and Django 2.0 App Deployment on Shared Hosting
(too old to reply)
Alok Vaidya
2017-12-25 22:14:14 UTC
Permalink
HI All,

I'm a very new into web development as well as very recently started with
Python 3.6.4 and Django 2.0 and built my first web application
successfully. Currently I'm in the process of deploying the web-app on a
shared hosting environment on Bluehost.

I was able to configure both Python and Django latest versions successfully
on Bluehost server using virstualenv and was able to create my test-app ass
well on the server directly using SSH client.

Where I'm stuck right now is to make this app work on my domain. I have
explored everything on google and tried everything possible from my side
but with no luck in the end. Ever time I try to access my website in my
local browser, I get the following error message:

500 Server Error
A misconfiguration on the server caused a hiccup. Check the server logs,
fix the problem, then try again.

I understand that it may not be sufficient information for anyone to help
me with. I'm very new to this whole process of community and forums etc, so
please let me know in case if you look for any additional info in this
regard.

I will greatly appreciate any help or pointing me into the right direction.

Alok.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d38290f8-dd4e-4038-a958-9fed5b32fa34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
carlos
2017-12-26 04:27:24 UTC
Permalink
Hi, actually i deploy very site in bluehost with django 1.11.x and python
2.7.x and it working well but i install the flup app
for working with fastcgi in bluehost, if you show me the config with flup
and version maybe help you.

Cheers
Post by Alok Vaidya
HI All,
I'm a very new into web development as well as very recently started with
Python 3.6.4 and Django 2.0 and built my first web application
successfully. Currently I'm in the process of deploying the web-app on a
shared hosting environment on Bluehost.
I was able to configure both Python and Django latest versions
successfully on Bluehost server using virstualenv and was able to create my
test-app ass well on the server directly using SSH client.
Where I'm stuck right now is to make this app work on my domain. I have
explored everything on google and tried everything possible from my side
but with no luck in the end. Ever time I try to access my website in my
500 Server Error
A misconfiguration on the server caused a hiccup. Check the server logs,
fix the problem, then try again.
I understand that it may not be sufficient information for anyone to help
me with. I'm very new to this whole process of community and forums etc, so
please let me know in case if you look for any additional info in this
regard.
I will greatly appreciate any help or pointing me into the right direction.
Alok.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/
msgid/django-users/d38290f8-dd4e-4038-a958-9fed5b32fa34%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/d38290f8-dd4e-4038-a958-9fed5b32fa34%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
att.
Carlos Rocha
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAM-7rO0UnSQ0mzKkkPq721HOvqLD%3D9yNymfOiBb2Lg08m205Pw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
c***@gmail.com
2018-01-05 21:01:09 UTC
Permalink
Hi! I am having the same problem. Did you get this to work yet? Any tips
would be greatly appreciated:

I am using a shared server, linux, Django 2.0, Python 3.6.4, flup6. Because
fastcgi is deprecated post Django 1.8 and Bluehost doesn't use WSGI and
only FastCGI (mod_fastcgi) I am using what NetAngels made available:
https://github.com/NetAngels/django-fastcgi

My .htaccess file is the project folder with my .fcgi file as is commonly
recommended. My .htaccess reads:

AddHandler fastcgi-script.fcgiRewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)% app.fcgi/$1 [QSA, L]

My .fcgi file reads:

#!/homeX/user/python3.6/bin/python36import sys, os
project_name = "app"
sys.path.insert(0, "homeX/user/python3.6/bin/python36")
sys.path.append("directory/of/my/project/app")
sys.path.append("directory/of/my/project/app/app")
sys.path.append("directory/of/my/project/app/app/app")
sys.path.append("directory/of/site-packages")
sys.path.append("directory/of/site-packages/flup")
sys.path.append("directory/of/site-packages/django")
os.chdir("directory/of/my/project/app/app/app")

os.environ['DJANGO_SETTINGS_MODULE'] = "settings"from django_fastcgi.servers.fastcgi import runfastcgifrom django.core.servers.basehttp import get_internal_wsgi_application
wsgi_application = get_internal_wsgi_application()

runfastcgi(wsgi_application, method="prefork", daemonize="false",
minspare=1, maxspare=1), maxchildren=1)

I have made sure to:

chmod 0755 app.fcgi

I am able to type into the linux SSH:

app.fcgi

This is what comes up in the SSH terminal:

WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!Not Found: /Status: 404 Not FoundContent-Type: text/html
X-Frame-Options: SAMEORIGINContent-Length: 2021
<!DOCTYPE html><html lang="en"><head><meta http-equiv="content-type" content="text/html; charset=utf-8"><title>Page not found at /</title><meta name="robots" content="NONE,NOARCHIVE"><style type="text/css">
html * { padding:0; margin:0; }
body * { padding:10px 20px; }
body * * { padding:0; }
body { font:small sans-serif; background:#eee; color:#000; }
body>div { border-bottom:1px solid #ddd; }
h1 { font-weight:normal; margin-bottom:.4em; }
h1 span { font-size:60%; color:#666; font-weight:normal; }
table { border:none; border-collapse: collapse; width:100%; }
td, th { vertical-align:top; padding:2px 3px; }
th { width:12em; text-align:right; color:#666; padding-right:.5em; }#info { background:#f6f6f6; }#info ol { margin: 0.5em 4em; }#info ol li { font-family: monospace; }#summary { background: #ffc; }#explanation { background:#eee; border-bottom: 0px none; }</style></head><body><div id="summary"><h1>Page not found <span>(404)</span></h1><table class="meta"><tr><th>Request Method:</th><td>GET</td></tr><tr><th>Request URL:</th><td>http://localhost/</td></tr>
</table></div><div id="info">
<p>Using the URLconf defined in <code>app.urls</code>,Django tried these URL patterns, in this order:</p><ol>
<li>

admin/
</li><li>

million/

</li></ol><p>
The empty path didn't match any of these.
</p>

</div>

<div id="explanation">
<p>
You're seeing this error because you have <code>DEBUG = True</code> in
your Django settings file. Change that to <code>False</code>, and Django
will display a standard 404 page.</p></div></body></html>

However, when I go to my website.com/app it shows me the standard 404 error
generated by my host. If I go to my website.com/app/app.fcgi it shows me
the contents of the file and not the HTML generated when I run app.fcgi. In
the main settings.py file,

DEBUG = True
ALLOWED_HOSTS = ['*']

But it will not show me the error generated by Django. I have tried putting
in host information, socket information, etc. and it always give me a 500
error when I go to my website.com/app.

I have messed around trying to connect FastCGIExternalServer to my .fcgi
file but I can never get the HTML as when I simply just use the default
settings that I get from NetAngels referenced above, despite the WSGI
warnings. It seems that because it is outputting my HTML, that everything
is fine (i.e., it will still display my HTML) because if I try to correct
for the WSGI warnings/errors, I don't ever see any of the HTML that Django
is generating which is below the WSGI errors.

I was able to get a debug.log working and this is what it says:

Exception while resolving variable 'name' in template 'unknown'.Traceback (most recent call last):File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/core/handlers/exception.py", line 35, in inner
response = get_response(request)File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/core/handlers/base.py", line 113, in _get_response
resolver_match = resolver.resolve(request.path_info)File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/urls/resolvers.py", line 523, in resolveraise Resolver404({'tried': tried, 'path': new_path})
django.urls.exceptions.Resolver404: {'tried': [[<URLResolver <module 'million.urls' from '/home2/usr/public_html/websitename/app/app/million/urls.py'> (None:None) '^million/'>], [<URLResolver <module 'million.urls' from '/home2/usr/public_html/websitename/app/app/million/urls.py'> (None:None) 'million/'>]], 'path': ''}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/template/base.py", line 835, in _resolve_lookup
current = current[bit]TypeError: 'URLResolver' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/template/base.py", line 843, in _resolve_lookup
current = getattr(current, bit)AttributeError: 'URLResolver' object has no attribute 'name'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/template/base.py", line 849, in _resolve_lookup
current = current[int(bit)]ValueError: invalid literal for int() with base 10: 'name'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/template/base.py", line 856, in _resolve_lookup(bit, current)) # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [name] in <URLResolver <module 'million.urls' from '/home2/usr/public_html/websitename/app/app/million/urls.py'> (None:None) '^million/'>Exception while resolving variable 'name' in template 'unknown'.Traceback (most recent call last):

Does anyone have any tips? Thank you for your time and help! I greatly
appreciate it!


Corey
Post by carlos
Hi, actually i deploy very site in bluehost with django 1.11.x and python
2.7.x and it working well but i install the flup app
for working with fastcgi in bluehost, if you show me the config with flup
and version maybe help you.
Cheers
Post by Alok Vaidya
HI All,
I'm a very new into web development as well as very recently started with
Python 3.6.4 and Django 2.0 and built my first web application
successfully. Currently I'm in the process of deploying the web-app on a
shared hosting environment on Bluehost.
I was able to configure both Python and Django latest versions
successfully on Bluehost server using virstualenv and was able to create my
test-app ass well on the server directly using SSH client.
Where I'm stuck right now is to make this app work on my domain. I have
explored everything on google and tried everything possible from my side
but with no luck in the end. Ever time I try to access my website in my
500 Server Error
A misconfiguration on the server caused a hiccup. Check the server logs,
fix the problem, then try again.
I understand that it may not be sufficient information for anyone to help
me with. I'm very new to this whole process of community and forums etc, so
please let me know in case if you look for any additional info in this
regard.
I will greatly appreciate any help or pointing me into the right direction.
Alok.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
<javascript:>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/d38290f8-dd4e-4038-a958-9fed5b32fa34%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/d38290f8-dd4e-4038-a958-9fed5b32fa34%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
att.
Carlos Rocha
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ab8a923c-e10f-4458-9514-2fc5bf64b982%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Matthew Pava
2018-01-05 22:57:14 UTC
Permalink
Looking at the .htaccess file and the example provided here: https://docs.djangoproject.com/en/1.8/howto/deployment/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache
It looks like you have a typo.
AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]

In the RewriteRule line, you have a % instead of a $.

Also, your DJANGO_SETTINGS_MODULE doesn’t have your project name specified.

Granted, these examples are from Django 1.8.

From: django-***@googlegroups.com [mailto:django-***@googlegroups.com] On Behalf Of ***@gmail.com
Sent: Friday, January 5, 2018 3:01 PM
To: Django users
Subject: Re: Issue with Python 3.6 and Django 2.0 App Deployment on Shared Hosting

Hi! I am having the same problem. Did you get this to work yet? Any tips would be greatly appreciated:

I am using a shared server, linux, Django 2.0, Python 3.6.4, flup6. Because fastcgi is deprecated post Django 1.8 and Bluehost doesn't use WSGI and only FastCGI (mod_fastcgi) I am using what NetAngels made available: https://github.com/NetAngels/django-fastcgi

My .htaccess file is the project folder with my .fcgi file as is commonly recommended. My .htaccess reads:

AddHandler fastcgi-script.fcgi

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)% app.fcgi/$1 [QSA, L]

My .fcgi file reads:

#!/homeX/user/python3.6/bin/python36

import sys, os

project_name = "app"

sys.path.insert(0, "homeX/user/python3.6/bin/python36")

sys.path.append("directory/of/my/project/app")

sys.path.append("directory/of/my/project/app/app")

sys.path.append("directory/of/my/project/app/app/app")

sys.path.append("directory/of/site-packages")

sys.path.append("directory/of/site-packages/flup")

sys.path.append("directory/of/site-packages/django")

os.chdir("directory/of/my/project/app/app/app")



os.environ['DJANGO_SETTINGS_MODULE'] = "settings"

from django_fastcgi.servers.fastcgi import runfastcgi

from django.core.servers.basehttp import get_internal_wsgi_application

wsgi_application = get_internal_wsgi_application()



runfastcgi(wsgi_application, method="prefork", daemonize="false",

minspare=1, maxspare=1), maxchildren=1)

I have made sure to:

chmod 0755 app.fcgi

I am able to type into the linux SSH:

app.fcgi

This is what comes up in the SSH terminal:

WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!

WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!

WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!

WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!

Not Found: /

Status: 404 Not Found

Content-Type: text/html

X-Frame-Options: SAMEORIGIN

Content-Length: 2021



<!DOCTYPE html>

<html lang="en">

<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8">

<title>Page not found at /</title>

<meta name="robots" content="NONE,NOARCHIVE">

<style type="text/css">

html * { padding:0; margin:0; }

body * { padding:10px 20px; }

body * * { padding:0; }

body { font:small sans-serif; background:#eee; color:#000; }

body>div { border-bottom:1px solid #ddd; }

h1 { font-weight:normal; margin-bottom:.4em; }

h1 span { font-size:60%; color:#666; font-weight:normal; }

table { border:none; border-collapse: collapse; width:100%; }

td, th { vertical-align:top; padding:2px 3px; }

th { width:12em; text-align:right; color:#666; padding-right:.5em; }

#info { background:#f6f6f6; }

#info ol { margin: 0.5em 4em; }

#info ol li { font-family: monospace; }

#summary { background: #ffc; }

#explanation { background:#eee; border-bottom: 0px none; }

</style>

</head>

<body>

<div id="summary">

<h1>Page not found <span>(404)</span></h1>

<table class="meta">

<tr>

<th>Request Method:</th>

<td>GET</td>

</tr>

<tr>

<th>Request URL:</th<URL:%3c/th>>

<td>http://localhost/</td<http://localhost/%3c/td>>

</tr>



</table>

</div>

<div id="info">



<p>

Using the URLconf defined in <code>app.urls</code>,

Django tried these URL patterns, in this order:

</p>

<ol>



<li>



admin/



</li>

<li>



million/





</li>

</ol>

<p>



The empty path didn't match any of these.

</p>



</div>



<div id="explanation">

<p>

You're seeing this error because you have <code>DEBUG = True</code> in

your Django settings file. Change that to <code>False</code>, and Django

will display a standard 404 page.

</p>

</div>

</body>

</html>

However, when I go to my website.com/app it shows me the standard 404 error generated by my host. If I go to my website.com/app/app.fcgi it shows me the contents of the file and not the HTML generated when I run app.fcgi. In the main settings.py file,

DEBUG = True

ALLOWED_HOSTS = ['*']

But it will not show me the error generated by Django. I have tried putting in host information, socket information, etc. and it always give me a 500 error when I go to my website.com/app.

I have messed around trying to connect FastCGIExternalServer to my .fcgi file but I can never get the HTML as when I simply just use the default settings that I get from NetAngels referenced above, despite the WSGI warnings. It seems that because it is outputting my HTML, that everything is fine (i.e., it will still display my HTML) because if I try to correct for the WSGI warnings/errors, I don't ever see any of the HTML that Django is generating which is below the WSGI errors.

I was able to get a debug.log working and this is what it says:

Exception while resolving variable 'name' in template 'unknown'.

Traceback (most recent call last):

File "/home2/usr/python3.6/lib/python3.6/site-

packages/django/core/handlers/exception.py", line 35, in inner

response = get_response(request)

File "/home2/usr/python3.6/lib/python3.6/site-

packages/django/core/handlers/base.py", line 113, in _get_response

resolver_match = resolver.resolve(request.path_info)

File "/home2/usr/python3.6/lib/python3.6/site-

packages/django/urls/resolvers.py", line 523, in resolve

raise Resolver404({'tried': tried, 'path': new_path})

django.urls.exceptions.Resolver404: {'tried': [[<URLResolver <module

'million.urls' from

'/home2/usr/public_html/websitename/app/app/million/urls.py'>

(None:None) '^million/'>], [<URLResolver <module 'million.urls' from

'/home2/usr/public_html/websitename/app/app/million/urls.py'>

(None:None) 'million/'>]], 'path': ''}



During handling of the above exception, another exception occurred:



Traceback (most recent call last):

File "/home2/usr/python3.6/lib/python3.6/site-

packages/django/template/base.py", line 835, in _resolve_lookup

current = current[bit]

TypeError: 'URLResolver' object is not subscriptable



During handling of the above exception, another exception occurred:



Traceback (most recent call last):

File "/home2/usr/python3.6/lib/python3.6/site-

packages/django/template/base.py", line 843, in _resolve_lookup

current = getattr(current, bit)

AttributeError: 'URLResolver' object has no attribute 'name'



During handling of the above exception, another exception occurred:



Traceback (most recent call last):

File "/home2/usr/python3.6/lib/python3.6/site-

packages/django/template/base.py", line 849, in _resolve_lookup

current = current[int(bit)]

ValueError: invalid literal for int() with base 10: 'name'



During handling of the above exception, another exception occurred:



Traceback (most recent call last):

File "/home2/usr/python3.6/lib/python3.6/site-

packages/django/template/base.py", line 856, in _resolve_lookup

(bit, current)) # missing attribute

django.template.base.VariableDoesNotExist: Failed lookup for key [name] in

<URLResolver <module 'million.urls' from

'/home2/usr/public_html/websitename/app/app/million/urls.py'>

(None:None) '^million/'>

Exception while resolving variable 'name' in template 'unknown'.

Traceback (most recent call last):

Does anyone have any tips? Thank you for your time and help! I greatly appreciate it!



Corey





On Monday, December 25, 2017 at 10:29:23 PM UTC-6, sacrac wrote:
Hi, actually i deploy very site in bluehost with django 1.11.x and python 2.7.x and it working well but i install the flup app
for working with fastcgi in bluehost, if you show me the config with flup and version maybe help you.

Cheers

On Mon, Dec 25, 2017 at 4:14 PM, Alok Vaidya <***@gmail.com<javascript:>> wrote:
HI All,

I'm a very new into web development as well as very recently started with Python 3.6.4 and Django 2.0 and built my first web application successfully. Currently I'm in the process of deploying the web-app on a shared hosting environment on Bluehost.

I was able to configure both Python and Django latest versions successfully on Bluehost server using virstualenv and was able to create my test-app ass well on the server directly using SSH client.

Where I'm stuck right now is to make this app work on my domain. I have explored everything on google and tried everything possible from my side but with no luck in the end. Ever time I try to access my website in my local browser, I get the following error message:

500 Server Error
A misconfiguration on the server caused a hiccup. Check the server logs, fix the problem, then try again.

I understand that it may not be sufficient information for anyone to help me with. I'm very new to this whole process of community and forums etc, so please let me know in case if you look for any additional info in this regard.

I will greatly appreciate any help or pointing me into the right direction.

Alok.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-***@googlegroups.com<javascript:>.
To post to this group, send email to ***@googlegroups.com<javascript:>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d38290f8-dd4e-4038-a958-9fed5b32fa34%40googlegroups.com<https://groups.google.com/d/msgid/django-users/d38290f8-dd4e-4038-a958-9fed5b32fa34%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.



--
att.
Carlos Rocha
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com<mailto:django-users+***@googlegroups.com>.
To post to this group, send email to django-***@googlegroups.com<mailto:django-***@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ab8a923c-e10f-4458-9514-2fc5bf64b982%40googlegroups.com<https://groups.google.com/d/msgid/django-users/ab8a923c-e10f-4458-9514-2fc5bf64b982%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2c51ac670f1c4f208773abdad8959245%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.
c***@gmail.com
2018-01-05 23:26:08 UTC
Permalink
Thanks a million for your fast response! I greatly appreciate it. I have
made those changes you recommended. I swear I looked at that a million
times and couldn't see a difference. Thanks for pointing that out. I also
added to my settings file under templates the word 'INFO' rather than
'DEBUG' and I am able to get my debug.log file to simply now say:

Not Found: /

These changes are definitely getting me closer. Thank you! I still see the
standard 404 page, however, and not the Django 404 page. If I run app.fcgi
in my shell I still get all of the Django-specific html but the following
errors remain:

WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!

I have tried looking at my fcgi_base.py which is where this error is coming
from to see what I should modify:

The following code there states:


for name,default in [('REQUEST_METHOD', 'GET'),
('SERVER_NAME', 'localhost'),
#('SERVER_NAME', '50.87.249.197'),
#('SERVER_PORT', '33606'),
('SERVER_PORT', '80'),
('SERVER_PROTOCOL', 'HTTP/1.0')]:
if name not in environ:
environ['wsgi.errors'].write(bytearray('%s:
missing FastCGI param %s '
'required by
WSGI!\n' %

(self.__class__.__name__, name), 'utf'))
environ[name] = default


That IP I believe is what bluehost recommended me to use but they can't
assign me a port because I am on a shared server. When I type in:

netstat --listen

I can see the open ports and 33606 should be open...

I have tried commenting on the code lines above and trying my specific IP
and and my port that I believe is open, but the result is the same.

Do you by chance see anything else I can try. If you would like I would be
more than happy to send you any information you request that you think may
be helpful in resolving this. Again, Thank you for your time and help! I
greatly appreciate it!

Best wishes!

Corey
Post by Matthew Pava
https://docs.djangoproject.com/en/1.8/howto/deployment/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache
It looks like you have a typo.
AddHandler fastcgi-script .fcgi
RewriteEngine *On*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]
In the RewriteRule line, you have a % instead of a $.
Also, your DJANGO_SETTINGS_MODULE doesn’t have your project name specified.
Granted, these examples are from Django 1.8.
*Sent:* Friday, January 5, 2018 3:01 PM
*To:* Django users
*Subject:* Re: Issue with Python 3.6 and Django 2.0 App Deployment on
Shared Hosting
Hi! I am having the same problem. Did you get this to work yet? Any tips
I am using a shared server, linux, Django 2.0, Python 3.6.4, flup6.
Because fastcgi is deprecated post Django 1.8 and Bluehost doesn't use WSGI
https://github.com/NetAngels/django-fastcgi
My .htaccess file is the project folder with my .fcgi file as is commonly
AddHandler fastcgi-script.fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)% app.fcgi/$1 [QSA, L]
#!/homeX/user/python3.6/bin/python36
import sys, os
project_name = "app"
sys.path.insert(0, "homeX/user/python3.6/bin/python36")
sys.path.append("directory/of/my/project/app")
sys.path.append("directory/of/my/project/app/app")
sys.path.append("directory/of/my/project/app/app/app")
sys.path.append("directory/of/site-packages")
sys.path.append("directory/of/site-packages/flup")
sys.path.append("directory/of/site-packages/django")
os.chdir("directory/of/my/project/app/app/app")
os.environ['DJANGO_SETTINGS_MODULE'] = "settings"
from django_fastcgi.servers.fastcgi import runfastcgi
from django.core.servers.basehttp import get_internal_wsgi_application
wsgi_application = get_internal_wsgi_application()
runfastcgi(wsgi_application, method="prefork", daemonize="false",
minspare=1, maxspare=1), maxchildren=1)
chmod 0755 app.fcgi
app.fcgi
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Not Found: /
Status: 404 Not Found
Content-Type: text/html
X-Frame-Options: SAMEORIGIN
Content-Length: 2021
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Page not found at /</title>
<meta name="robots" content="NONE,NOARCHIVE">
<style type="text/css">
html * { padding:0; margin:0; }
body * { padding:10px 20px; }
body * * { padding:0; }
body { font:small sans-serif; background:#eee; color:#000; }
body>div { border-bottom:1px solid #ddd; }
h1 { font-weight:normal; margin-bottom:.4em; }
h1 span { font-size:60%; color:#666; font-weight:normal; }
table { border:none; border-collapse: collapse; width:100%; }
td, th { vertical-align:top; padding:2px 3px; }
th { width:12em; text-align:right; color:#666; padding-right:.5em; }
#info { background:#f6f6f6; }
#info ol { margin: 0.5em 4em; }
#info ol li { font-family: monospace; }
#summary { background: #ffc; }
#explanation { background:#eee; border-bottom: 0px none; }
</style>
</head>
<body>
<div id="summary">
<h1>Page not found <span>(404)</span></h1>
<table class="meta">
<tr>
<th>Request Method:</th>
<td>GET</td>
</tr>
<tr>
<th>Request URL:</th>
<td>http://localhost/</td>
</tr>
</table>
</div>
<div id="info">
<p>
Using the URLconf defined in <code>app.urls</code>,
</p>
<ol>
<li>
admin/
</li>
<li>
million/
</li>
</ol>
<p>
The empty path didn't match any of these.
</p>
</div>
<div id="explanation">
<p>
You're seeing this error because you have <code>DEBUG = True</code> in
your Django settings file. Change that to <code>False</code>, and Django
will display a standard 404 page.
</p>
</div>
</body>
</html>
However, when I go to my website.com/app it shows me the standard 404
error generated by my host. If I go to my website.com/app/app.fcgi it
shows me the contents of the file and not the HTML generated when I run
app.fcgi. In the main settings.py file,
DEBUG = True
ALLOWED_HOSTS = ['*']
But it will not show me the error generated by Django. I have tried
putting in host information, socket information, etc. and it always give me
a 500 error when I go to my website.com/app.
I have messed around trying to connect FastCGIExternalServer to my .fcgi
file but I can never get the HTML as when I simply just use the default
settings that I get from NetAngels referenced above, despite the WSGI
warnings. It seems that because it is outputting my HTML, that everything
is fine (i.e., it will still display my HTML) because if I try to correct
for the WSGI warnings/errors, I don't ever see any of the HTML that Django
is generating which is below the WSGI errors.
Exception while resolving variable 'name' in template 'unknown'.
File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/core/handlers/exception.py", line 35, in inner
response = get_response(request)
File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/core/handlers/base.py", line 113, in _get_response
resolver_match = resolver.resolve(request.path_info)
File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/urls/resolvers.py", line 523, in resolve
raise Resolver404({'tried': tried, 'path': new_path})
django.urls.exceptions.Resolver404: {'tried': [[<URLResolver <module
'million.urls' from
'/home2/usr/public_html/websitename/app/app/million/urls.py'>
(None:None) '^million/'>], [<URLResolver <module 'million.urls' from
'/home2/usr/public_html/websitename/app/app/million/urls.py'>
(None:None) 'million/'>]], 'path': ''}
File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/template/base.py", line 835, in _resolve_lookup
current = current[bit]
TypeError: 'URLResolver' object is not subscriptable
File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/template/base.py", line 843, in _resolve_lookup
current = getattr(current, bit)
AttributeError: 'URLResolver' object has no attribute 'name'
File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/template/base.py", line 849, in _resolve_lookup
current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'name'
File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/template/base.py", line 856, in _resolve_lookup
(bit, current)) # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [name] in
<URLResolver <module 'million.urls' from
'/home2/usr/public_html/websitename/app/app/million/urls.py'>
(None:None) '^million/'>
Exception while resolving variable 'name' in template 'unknown'.
Does anyone have any tips? Thank you for your time and help! I greatly appreciate it!
Corey
Hi, actually i deploy very site in bluehost with django 1.11.x and python
2.7.x and it working well but i install the flup app
for working with fastcgi in bluehost, if you show me the config with flup
and version maybe help you.
Cheers
HI All,
I'm a very new into web development as well as very recently started with
Python 3.6.4 and Django 2.0 and built my first web application
successfully. Currently I'm in the process of deploying the web-app on a
shared hosting environment on Bluehost.
I was able to configure both Python and Django latest versions
successfully on Bluehost server using virstualenv and was able to create my
test-app ass well on the server directly using SSH client.
Where I'm stuck right now is to make this app work on my domain. I have
explored everything on google and tried everything possible from my side
but with no luck in the end. Ever time I try to access my website in my
500 Server Error
A misconfiguration on the server caused a hiccup. Check the server logs,
fix the problem, then try again.
I understand that it may not be sufficient information for anyone to help
me with. I'm very new to this whole process of community and forums etc, so
please let me know in case if you look for any additional info in this
regard.
I will greatly appreciate any help or pointing me into the right direction.
Alok.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/d38290f8-dd4e-4038-a958-9fed5b32fa34%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/d38290f8-dd4e-4038-a958-9fed5b32fa34%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
att.
Carlos Rocha
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
<javascript:>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/ab8a923c-e10f-4458-9514-2fc5bf64b982%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/ab8a923c-e10f-4458-9514-2fc5bf64b982%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/61b94dc7-3e65-4a71-9fca-eb7a606150be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Annchen Knodt
2018-12-01 15:43:21 UTC
Permalink
Hi Corey,
I'm having what seems to be the exact same problem with django/fcgi on
bluehost shared hosting (getting a 404 in the browser but the appropriate
html on the command line; I posted my question here
<https://stackoverflow.com/questions/53474157/django-2-0-7-with-fastcgi-gives-404-in-browser-but-works-on-command-line>),
so I'm wondering if/how you ended up resolving it. Any tips would be
greatly appreciated, thanks!!!
Annchen
Post by c***@gmail.com
Thanks a million for your fast response! I greatly appreciate it. I have
made those changes you recommended. I swear I looked at that a million
times and couldn't see a difference. Thanks for pointing that out. I also
added to my settings file under templates the word 'INFO' rather than
Not Found: /
These changes are definitely getting me closer. Thank you! I still see the
standard 404 page, however, and not the Django 404 page. If I run app.fcgi
in my shell I still get all of the Django-specific html but the following
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
I have tried looking at my fcgi_base.py which is where this error is
for name,default in [('REQUEST_METHOD', 'GET'),
('SERVER_NAME', 'localhost'),
#('SERVER_NAME', '50.87.249.197'),
#('SERVER_PORT', '33606'),
('SERVER_PORT', '80'),
missing FastCGI param %s '
'required by
WSGI!\n' %
(self.__class__.__name__, name), 'utf'))
environ[name] = default
That IP I believe is what bluehost recommended me to use but they can't
netstat --listen
I can see the open ports and 33606 should be open...
I have tried commenting on the code lines above and trying my specific IP
and and my port that I believe is open, but the result is the same.
Do you by chance see anything else I can try. If you would like I would be
more than happy to send you any information you request that you think may
be helpful in resolving this. Again, Thank you for your time and help! I
greatly appreciate it!
Best wishes!
Corey
Post by Matthew Pava
https://docs.djangoproject.com/en/1.8/howto/deployment/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache
It looks like you have a typo.
AddHandler fastcgi-script .fcgi
RewriteEngine *On*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]
In the RewriteRule line, you have a % instead of a $.
Also, your DJANGO_SETTINGS_MODULE doesn’t have your project name specified.
Granted, these examples are from Django 1.8.
*Sent:* Friday, January 5, 2018 3:01 PM
*To:* Django users
*Subject:* Re: Issue with Python 3.6 and Django 2.0 App Deployment on
Shared Hosting
Hi! I am having the same problem. Did you get this to work yet? Any tips
I am using a shared server, linux, Django 2.0, Python 3.6.4, flup6.
Because fastcgi is deprecated post Django 1.8 and Bluehost doesn't use WSGI
https://github.com/NetAngels/django-fastcgi
My .htaccess file is the project folder with my .fcgi file as is commonly
AddHandler fastcgi-script.fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)% app.fcgi/$1 [QSA, L]
#!/homeX/user/python3.6/bin/python36
import sys, os
project_name = "app"
sys.path.insert(0, "homeX/user/python3.6/bin/python36")
sys.path.append("directory/of/my/project/app")
sys.path.append("directory/of/my/project/app/app")
sys.path.append("directory/of/my/project/app/app/app")
sys.path.append("directory/of/site-packages")
sys.path.append("directory/of/site-packages/flup")
sys.path.append("directory/of/site-packages/django")
os.chdir("directory/of/my/project/app/app/app")
os.environ['DJANGO_SETTINGS_MODULE'] = "settings"
from django_fastcgi.servers.fastcgi import runfastcgi
from django.core.servers.basehttp import get_internal_wsgi_application
wsgi_application = get_internal_wsgi_application()
runfastcgi(wsgi_application, method="prefork", daemonize="false",
minspare=1, maxspare=1), maxchildren=1)
chmod 0755 app.fcgi
app.fcgi
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Not Found: /
Status: 404 Not Found
Content-Type: text/html
X-Frame-Options: SAMEORIGIN
Content-Length: 2021
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Page not found at /</title>
<meta name="robots" content="NONE,NOARCHIVE">
<style type="text/css">
html * { padding:0; margin:0; }
body * { padding:10px 20px; }
body * * { padding:0; }
body { font:small sans-serif; background:#eee; color:#000; }
body>div { border-bottom:1px solid #ddd; }
h1 { font-weight:normal; margin-bottom:.4em; }
h1 span { font-size:60%; color:#666; font-weight:normal; }
table { border:none; border-collapse: collapse; width:100%; }
td, th { vertical-align:top; padding:2px 3px; }
th { width:12em; text-align:right; color:#666; padding-right:.5em; }
#info { background:#f6f6f6; }
#info ol { margin: 0.5em 4em; }
#info ol li { font-family: monospace; }
#summary { background: #ffc; }
#explanation { background:#eee; border-bottom: 0px none; }
</style>
</head>
<body>
<div id="summary">
<h1>Page not found <span>(404)</span></h1>
<table class="meta">
<tr>
<th>Request Method:</th>
<td>GET</td>
</tr>
<tr>
<th>Request URL:</th>
<td>http://localhost/</td>
</tr>
</table>
</div>
<div id="info">
<p>
Using the URLconf defined in <code>app.urls</code>,
</p>
<ol>
<li>
admin/
</li>
<li>
million/
</li>
</ol>
<p>
The empty path didn't match any of these.
</p>
</div>
<div id="explanation">
<p>
You're seeing this error because you have <code>DEBUG = True</code> in
your Django settings file. Change that to <code>False</code>, and Django
will display a standard 404 page.
</p>
</div>
</body>
</html>
However, when I go to my website.com/app it shows me the standard 404
error generated by my host. If I go to my website.com/app/app.fcgi it
shows me the contents of the file and not the HTML generated when I run
app.fcgi. In the main settings.py file,
DEBUG = True
ALLOWED_HOSTS = ['*']
But it will not show me the error generated by Django. I have tried
putting in host information, socket information, etc. and it always give me
a 500 error when I go to my website.com/app.
I have messed around trying to connect FastCGIExternalServer to my .fcgi
file but I can never get the HTML as when I simply just use the default
settings that I get from NetAngels referenced above, despite the WSGI
warnings. It seems that because it is outputting my HTML, that everything
is fine (i.e., it will still display my HTML) because if I try to correct
for the WSGI warnings/errors, I don't ever see any of the HTML that Django
is generating which is below the WSGI errors.
Exception while resolving variable 'name' in template 'unknown'.
File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/core/handlers/exception.py", line 35, in inner
response = get_response(request)
File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/core/handlers/base.py", line 113, in _get_response
resolver_match = resolver.resolve(request.path_info)
File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/urls/resolvers.py", line 523, in resolve
raise Resolver404({'tried': tried, 'path': new_path})
django.urls.exceptions.Resolver404: {'tried': [[<URLResolver <module
'million.urls' from
'/home2/usr/public_html/websitename/app/app/million/urls.py'>
(None:None) '^million/'>], [<URLResolver <module 'million.urls' from
'/home2/usr/public_html/websitename/app/app/million/urls.py'>
(None:None) 'million/'>]], 'path': ''}
File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/template/base.py", line 835, in _resolve_lookup
current = current[bit]
TypeError: 'URLResolver' object is not subscriptable
File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/template/base.py", line 843, in _resolve_lookup
current = getattr(current, bit)
AttributeError: 'URLResolver' object has no attribute 'name'
File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/template/base.py", line 849, in _resolve_lookup
current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'name'
File "/home2/usr/python3.6/lib/python3.6/site-
packages/django/template/base.py", line 856, in _resolve_lookup
(bit, current)) # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [name] in
<URLResolver <module 'million.urls' from
'/home2/usr/public_html/websitename/app/app/million/urls.py'>
(None:None) '^million/'>
Exception while resolving variable 'name' in template 'unknown'.
Does anyone have any tips? Thank you for your time and help! I greatly appreciate it!
Corey
Hi, actually i deploy very site in bluehost with django 1.11.x and python
2.7.x and it working well but i install the flup app
for working with fastcgi in bluehost, if you show me the config with flup
and version maybe help you.
Cheers
HI All,
I'm a very new into web development as well as very recently started with
Python 3.6.4 and Django 2.0 and built my first web application
successfully. Currently I'm in the process of deploying the web-app on a
shared hosting environment on Bluehost.
I was able to configure both Python and Django latest versions
successfully on Bluehost server using virstualenv and was able to create my
test-app ass well on the server directly using SSH client.
Where I'm stuck right now is to make this app work on my domain. I have
explored everything on google and tried everything possible from my side
but with no luck in the end. Ever time I try to access my website in my
500 Server Error
A misconfiguration on the server caused a hiccup. Check the server logs,
fix the problem, then try again.
I understand that it may not be sufficient information for anyone to help
me with. I'm very new to this whole process of community and forums etc, so
please let me know in case if you look for any additional info in this
regard.
I will greatly appreciate any help or pointing me into the right direction.
Alok.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/d38290f8-dd4e-4038-a958-9fed5b32fa34%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/d38290f8-dd4e-4038-a958-9fed5b32fa34%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
att.
Carlos Rocha
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/ab8a923c-e10f-4458-9514-2fc5bf64b982%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/ab8a923c-e10f-4458-9514-2fc5bf64b982%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4b94265a-ec97-4484-9d63-2c0b3de9ef50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Corey Bishop
2018-12-05 03:35:43 UTC
Permalink
Hi! Thanks for your email. The best advice I received and I am so glad that
I took it was switching to heroku. Heroku makes everything so easy. I still
use Bluehost and then I point it at my heroku app. Heroku is the best. I
use postgresql with them and only recently had to start paying them. They
give you up to 10k rows of database for free. I pay 10 per month now and
have 10 million rows and don't pay them for anything else. They solved all
of my problems. It is a pain to switch but highly worth it. You still need
Bluehost though because heroku is a platform as a service type of company.
I had issues with fcgi that heroku resolved, in addition to all sorts of
other things I needed for plotting data on the web. Hopefully this helps
you. Let me know if you have other questions.

Best wishes,
Post by Annchen Knodt
Hi Corey,
I'm having what seems to be the exact same problem with django/fcgi on
bluehost shared hosting (getting a 404 in the browser but the appropriate
html on the command line; I posted my question here
<https://stackoverflow.com/questions/53474157/django-2-0-7-with-fastcgi-gives-404-in-browser-but-works-on-command-line>),
so I'm wondering if/how you ended up resolving it. Any tips would be
greatly appreciated, thanks!!!
Annchen
Post by c***@gmail.com
Thanks a million for your fast response! I greatly appreciate it. I have
made those changes you recommended. I swear I looked at that a million
times and couldn't see a difference. Thanks for pointing that out. I also
added to my settings file under templates the word 'INFO' rather than
Not Found: /
These changes are definitely getting me closer. Thank you! I still see
the standard 404 page, however, and not the Django 404 page. If I run
app.fcgi in my shell I still get all of the Django-specific html but the
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
I have tried looking at my fcgi_base.py which is where this error is
for name,default in [('REQUEST_METHOD', 'GET'),
('SERVER_NAME', 'localhost'),
#('SERVER_NAME', '50.87.249.197'),
#('SERVER_PORT', '33606'),
('SERVER_PORT', '80'),
missing FastCGI param %s '
'required by
WSGI!\n' %
(self.__class__.__name__, name), 'utf'))
environ[name] = default
That IP I believe is what bluehost recommended me to use but they can't
netstat --listen
I can see the open ports and 33606 should be open...
I have tried commenting on the code lines above and trying my specific IP
and and my port that I believe is open, but the result is the same.
Do you by chance see anything else I can try. If you would like I would
be more than happy to send you any information you request that you think
may be helpful in resolving this. Again, Thank you for your time and help!
I greatly appreciate it!
Best wishes!
Corey
Post by Matthew Pava
https://docs.djangoproject.com/en/1.8/howto/deployment/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache
It looks like you have a typo.
AddHandler fastcgi-script .fcgi
RewriteEngine *On*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]
In the RewriteRule line, you have a % instead of a $.
Also, your DJANGO_SETTINGS_MODULE doesn’t have your project name specified.
Granted, these examples are from Django 1.8.
*Sent:* Friday, January 5, 2018 3:01 PM
*To:* Django users
*Subject:* Re: Issue with Python 3.6 and Django 2.0 App Deployment on
Shared Hosting
Hi! I am having the same problem. Did you get this to work yet? Any tips
I am using a shared server, linux, Django 2.0, Python 3.6.4, flup6.
Because fastcgi is deprecated post Django 1.8 and Bluehost doesn't use WSGI
https://github.com/NetAngels/django-fastcgi
My .htaccess file is the project folder with my .fcgi file as is
AddHandler fastcgi-script.fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)% app.fcgi/$1 [QSA, L]
#!/homeX/user/python3.6/bin/python36
import sys, os
project_name = "app"
sys.path.insert(0, "homeX/user/python3.6/bin/python36")
sys.path.append("directory/of/my/project/app")
sys.path.append("directory/of/my/project/app/app")
sys.path.append("directory/of/my/project/app/app/app")
sys.path.append("directory/of/site-packages")
sys.path.append("directory/of/site-packages/flup")
sys.path.append("directory/of/site-packages/django")
os.chdir("directory/of/my/project/app/app/app")
os.environ['DJANGO_SETTINGS_MODULE'] = "settings"
from django_fastcgi.servers.fastcgi import runfastcgi
from django.core.servers.basehttp import get_internal_wsgi_application
wsgi_application = get_internal_wsgi_application()
runfastcgi(wsgi_application, method="prefork", daemonize="false",
minspare=1, maxspare=1), maxchildren=1)
chmod 0755 app.fcgi
app.fcgi
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Not Found: /
Status: 404 Not Found
Content-Type: text/html
X-Frame-Options: SAMEORIGIN
Content-Length: 2021
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Page not found at /</title>
<meta name="robots" content="NONE,NOARCHIVE">
<style type="text/css">
html * { padding:0; margin:0; }
body * { padding:10px 20px; }
body * * { padding:0; }
body { font:small sans-serif; background:#eee; color:#000; }
body>div { border-bottom:1px solid #ddd; }
h1 { font-weight:normal; margin-bottom:.4em; }
h1 span { font-size:60%; color:#666; font-weight:normal; }
table { border:none; border-collapse: collapse; width:100%; }
td, th { vertical-align:top; padding:2px 3px; }
th { width:12em; text-align:right; color:#666; padding-right:.5em; }
#info { background:#f6f6f6; }
#info ol { margin: 0.5em 4em; }
#info ol li { font-family: monospace; }
#summary { background: #ffc; }
#explanation { background:#eee; border-bottom: 0px none; }
</style>
</head>
<body>
<div id="summary">
<h1>Page not found <span>(404)</span></h1>
<table class="meta">
<tr>
<th>Request Method:</th>
<td>GET</td>
</tr>
<tr>
<th>Request URL:</th>
<td>http://localhost/</td>
</tr>
</table>
</div>
<div id="info">
<p>
Using the URLconf defined in <code>app.urls</code>,
</p>
<ol>
<li>
admin/
</li>
<li>
million/
</li>
</ol>
<p>
The empty path didn't match any of these.
</p>
</div>
<div id="explanation">
<p>
You're seeing this error because you have <code>DEBUG = True</code> in
your Django settings file. Change that to <code>False</code>, and Django
will display a standard 404 page.
</p>
</div>
</body>
</html>
However, when I go to my website.com/app it shows me the standard 404
error generated by my host. If I go to my website.com/app/app.fcgi it
shows me the contents of the file and not the HTML generated when I run
app.fcgi. In the main settings.py file,
DEBUG = True
ALLOWED_HOSTS = ['*']
But it will not show me the error generated by Django. I have tried
putting in host information, socket information, etc. and it always give me
a 500 error when I go to my website.com/app.
I have messed around trying to connect FastCGIExternalServer to my .fcgi
file but I can never get the HTML as when I simply just use the default
settings that I get from NetAngels referenced above, despite the WSGI
warnings. It seems that because it is outputting my HTML, that everything
is fine (i.e., it will still display my HTML) because if I try to correct
for the WSGI warnings/errors, I don't ever see any of the HTML that Django
is generating which is below the WSGI errors.
Exception while resolving variable 'name' in template 'unknown'.
Traceback (
--
Corey J. Bishop, Ph.D.
Assistant Professor of Biomedical Engineering
Principal Investigator of the Pharmacoengineering Laboratory:
pharmacoengineering.wordpress.com
Dwight Look College of Engineering
Texas A&M University
Emerging Technologies Building Room 5016
College Station, TX 77843
***@tamu.edu
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAC-nf1aDc0HK%2BbwTQDnjMwKFV9OPuhX0abiGwOjXu_3uqYp8tg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Annchen Knodt
2018-12-09 20:20:15 UTC
Permalink
Thanks for your response, Corey - this is good to know! I ended up
switching to Dreamhost where I had no problems getting up and running with
django 
 turns out bluehost has updated their shared hosting plans to be
more restrictive and that seems like that's what was causing my issues.

Thanks again,
Annchen
Post by Corey Bishop
Hi! Thanks for your email. The best advice I received and I am so glad
that I took it was switching to heroku. Heroku makes everything so easy. I
still use Bluehost and then I point it at my heroku app. Heroku is the
best. I use postgresql with them and only recently had to start paying
them. They give you up to 10k rows of database for free. I pay 10 per month
now and have 10 million rows and don't pay them for anything else. They
solved all of my problems. It is a pain to switch but highly worth it. You
still need Bluehost though because heroku is a platform as a service type
of company. I had issues with fcgi that heroku resolved, in addition to all
sorts of other things I needed for plotting data on the web. Hopefully this
helps you. Let me know if you have other questions.
Best wishes,
Post by Annchen Knodt
Hi Corey,
I'm having what seems to be the exact same problem with django/fcgi on
bluehost shared hosting (getting a 404 in the browser but the appropriate
html on the command line; I posted my question here
<https://stackoverflow.com/questions/53474157/django-2-0-7-with-fastcgi-gives-404-in-browser-but-works-on-command-line>),
so I'm wondering if/how you ended up resolving it. Any tips would be
greatly appreciated, thanks!!!
Annchen
Post by c***@gmail.com
Thanks a million for your fast response! I greatly appreciate it. I have
made those changes you recommended. I swear I looked at that a million
times and couldn't see a difference. Thanks for pointing that out. I also
added to my settings file under templates the word 'INFO' rather than
Not Found: /
These changes are definitely getting me closer. Thank you! I still see
the standard 404 page, however, and not the Django 404 page. If I run
app.fcgi in my shell I still get all of the Django-specific html but the
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
I have tried looking at my fcgi_base.py which is where this error is
for name,default in [('REQUEST_METHOD', 'GET'),
('SERVER_NAME', 'localhost'),
#('SERVER_NAME', '50.87.249.197'),
#('SERVER_PORT', '33606'),
('SERVER_PORT', '80'),
missing FastCGI param %s '
'required by
WSGI!\n' %
(self.__class__.__name__, name), 'utf'))
environ[name] = default
That IP I believe is what bluehost recommended me to use but they can't
netstat --listen
I can see the open ports and 33606 should be open...
I have tried commenting on the code lines above and trying my specific
IP and and my port that I believe is open, but the result is the same.
Do you by chance see anything else I can try. If you would like I would
be more than happy to send you any information you request that you think
may be helpful in resolving this. Again, Thank you for your time and help!
I greatly appreciate it!
Best wishes!
Corey
Post by Matthew Pava
https://docs.djangoproject.com/en/1.8/howto/deployment/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache
It looks like you have a typo.
AddHandler fastcgi-script .fcgi
RewriteEngine *On*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]
In the RewriteRule line, you have a % instead of a $.
Also, your DJANGO_SETTINGS_MODULE doesn’t have your project name specified.
Granted, these examples are from Django 1.8.
*Sent:* Friday, January 5, 2018 3:01 PM
*To:* Django users
*Subject:* Re: Issue with Python 3.6 and Django 2.0 App Deployment on
Shared Hosting
Hi! I am having the same problem. Did you get this to work yet? Any
I am using a shared server, linux, Django 2.0, Python 3.6.4, flup6.
Because fastcgi is deprecated post Django 1.8 and Bluehost doesn't use WSGI
https://github.com/NetAngels/django-fastcgi
My .htaccess file is the project folder with my .fcgi file as is
AddHandler fastcgi-script.fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)% app.fcgi/$1 [QSA, L]
#!/homeX/user/python3.6/bin/python36
import sys, os
project_name = "app"
sys.path.insert(0, "homeX/user/python3.6/bin/python36")
sys.path.append("directory/of/my/project/app")
sys.path.append("directory/of/my/project/app/app")
sys.path.append("directory/of/my/project/app/app/app")
sys.path.append("directory/of/site-packages")
sys.path.append("directory/of/site-packages/flup")
sys.path.append("directory/of/site-packages/django")
os.chdir("directory/of/my/project/app/app/app")
os.environ['DJANGO_SETTINGS_MODULE'] = "settings"
from django_fastcgi.servers.fastcgi import runfastcgi
from django.core.servers.basehttp import get_internal_wsgi_application
wsgi_application = get_internal_wsgi_application()
runfastcgi(wsgi_application, method="prefork", daemonize="false",
minspare=1, maxspare=1), maxchildren=1)
chmod 0755 app.fcgi
app.fcgi
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Not Found: /
Status: 404 Not Found
Content-Type: text/html
X-Frame-Options: SAMEORIGIN
Content-Length: 2021
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Page not found at /</title>
<meta name="robots" content="NONE,NOARCHIVE">
<style type="text/css">
html * { padding:0; margin:0; }
body * { padding:10px 20px; }
body * * { padding:0; }
body { font:small sans-serif; background:#eee; color:#000; }
body>div { border-bottom:1px solid #ddd; }
h1 { font-weight:normal; margin-bottom:.4em; }
h1 span { font-size:60%; color:#666; font-weight:normal; }
table { border:none; border-collapse: collapse; width:100%; }
td, th { vertical-align:top; padding:2px 3px; }
th { width:12em; text-align:right; color:#666; padding-right:.5em; }
#info { background:#f6f6f6; }
#info ol { margin: 0.5em 4em; }
#info ol li { font-family: monospace; }
#summary { background: #ffc; }
#explanation { background:#eee; border-bottom: 0px none; }
</style>
</head>
<body>
<div id="summary">
<h1>Page not found <span>(404)</span></h1>
<table class="meta">
<tr>
<th>Request Method:</th>
<td>GET</td>
</tr>
<tr>
<th>Request URL:</th>
<td>http://localhost/</td>
</tr>
</table>
</div>
<div id="info">
<p>
Using the URLconf defined in <code>app.urls</code>,
</p>
<ol>
<li>
admin/
</li>
<li>
million/
</li>
</ol>
<p>
The empty path didn't match any of these.
</p>
</div>
<div id="explanation">
<p>
You're seeing this error because you have <code>DEBUG = True</code> in
your Django settings file. Change that to <code>False</code>, and Django
will display a standard 404 page.
</p>
</div>
</body>
</html>
However, when I go to my website.com/app it shows me the standard 404
error generated by my host. If I go to my website.com/app/app.fcgi it
shows me the contents of the file and not the HTML generated when I run
app.fcgi. In the main settings.py file,
DEBUG = True
ALLOWED_HOSTS = ['*']
But it will not show me the error generated by Django. I have tried
putting in host information, socket information, etc. and it always give me
a 500 error when I go to my website.com/app.
I have messed around trying to connect FastCGIExternalServer to my
.fcgi file but I can never get the HTML as when I simply just use the
default settings that I get from NetAngels referenced above, despite the
WSGI warnings. It seems that because it is outputting my HTML, that
everything is fine (i.e., it will still display my HTML) because if I try
to correct for the WSGI warnings/errors, I don't ever see any of the HTML
that Django is generating which is below the WSGI errors.
Exception while resolving variable 'name' in template 'unknown'.
Traceback (
--
Corey J. Bishop, Ph.D.
Assistant Professor of Biomedical Engineering
pharmacoengineering.wordpress.com
Dwight Look College of Engineering
Texas A&M University
Emerging Technologies Building Room 5016
College Station, TX 77843
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6a9ff601-72ce-43d5-b186-c27f75a076a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Matemática A3K
2018-01-06 06:56:51 UTC
Permalink
Post by Alok Vaidya
HI All,
I'm a very new into web development as well as very recently started with
Python 3.6.4 and Django 2.0 and built my first web application
successfully. Currently I'm in the process of deploying the web-app on a
shared hosting environment on Bluehost.
I was able to configure both Python and Django latest versions
successfully on Bluehost server using virstualenv and was able to create my
test-app ass well on the server directly using SSH client.
Where I'm stuck right now is to make this app work on my domain. I have
explored everything on google and tried everything possible from my side
but with no luck in the end. Ever time I try to access my website in my
500 Server Error
A misconfiguration on the server caused a hiccup. Check the server logs,
fix the problem, then try again.
I understand that it may not be sufficient information for anyone to help
me with. I'm very new to this whole process of community and forums etc, so
please let me know in case if you look for any additional info in this
regard.
I will greatly appreciate any help or pointing me into the right direction.
In the logs you will find detailed information about the error, you should
start looking at that
Post by Alok Vaidya
Alok.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/
msgid/django-users/d38290f8-dd4e-4038-a958-9fed5b32fa34%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/d38290f8-dd4e-4038-a958-9fed5b32fa34%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BFDnhLB6tOt4HvcyvLF3CnNQQvB%2BLdamiOFDzRN6%2BDjH0EV0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...