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, On Sat, Dec 1, 2018 at 09:48 Annchen Knodt <[email protected]> wrote: > 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 > > On Friday, January 5, 2018 at 6:26:08 PM UTC-5, [email protected] wrote: >> >> 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 >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> On Friday, January 5, 2018 at 4:59:24 PM UTC-6, Matthew Pava wrote: >>> >>> 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:* [email protected] [mailto:[email protected]] *On >>> Behalf Of *[email protected] >>> *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> >>> >>> <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 ( >>> >>> -- 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 [email protected] -- 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 [email protected]. To post to this group, send email to [email protected]. 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.

