Forums

reload failing

I keep getting this when i reload. Sorry, there was a problem. You many need to check your DNS setup. Or, if you're using a virtualenv, you should check whether its Python version matches the one you've specified here. If it keeps happening, please send us feedback. I haven't changed anything but a whole lot of things (Lol). If you go to my site, derekriemer.pythonanywhere.com/weather half the website loads, but it doesn't update with proper information. Besides a dns error what could this be? Thanks.

Hmm, I just took a look and it's not giving that error now -- did you find out what the problem was and fix it?

It seems to have, but I didn't do really anything. Also, it seems that the same code that runs perfectly on my machine with no errors is just not loading on that site. It just silently fails.

That's very strange. Is there anything in your error log?

A couple of things that might be different between your local machine and PythonAnywhere that have caused problems for people in the past:

  • Working directories. On PythonAnywhere, the process for your web app will be running in your home directory. Perhaps you have some relative paths?
  • Multiple worker processes. This is probably not the problem because you have a free account, which will normally only have one worker process per web app, but it's possible that your code assumes that everything's happening in the same process and the process management stuff that's happening in the background is killing the worker process and restarting it in a manner that's confusing your code.

Well, yes. I am referencing a file like this. api_key = open("get_weather/api_key").read(100) #only read the first 100 chars since the api key wouldn't be this long anyway.

Would this be part of my issue?

If so, would it be better to do something like

os.path.join(os.path.dirname(file), 'get_weather/apikey').replace('\','/')

Or should I put the api key in my local settings for secure things like my secret key and then reference it from derek_site.settings.API_KEY? I am working on windows here, and the server environment is linux, and I think django likes unix style paths.

There isn't an error in any of the logs, not even a hint towards an error.

bingo. Thanks for the absolute path info. That worked.

On a side note, if I just want a simple domain of my own, and maybe the ability to send email from my site, (a contact me form), with several apps like a portfolio, and a personal website and other tidbits, which plan would be the best option? I don't anticipate a whole lot of visitors for it, just people who I direct to my site like future employers, or other students who wish to see my portfolio?

I would do a custom plan with the # of webapps that you need, probably 1 worker.

The number of workers will depend on what your webapps actually do of course.

If your webapp does anything self-referential (eg: when u get a request to do something, you actually send another request to a diff url on your site to trigger it), then you will will need at least 2 workers, because the first one will be blocked trying to process the first request and you will just hang indefinitely.

If you just want the contact me form to send you an email to your existing email account, then that should be fine as is. Otherwise you can integrate with sendgrid/cloudmailin etc to receive email as well.