0

I have a client with a django web application which pulls information from a different web application and displays it on a web page.

The web application suddenly stopped working and the following message appeared in the server's supervisorctl:

https://i.stack.imgur.com/xG3ig.jpg

I didn't have much time, so I traced the error to the CorsHeaders middleware and commented it out from the website's settings.py while I work on a long term solution. To save people time researching, Cors is a middleware which allows web browsers to access your server even if it is in a different domain than the web page. (aka what the client uses to upload their data from one webapp to another)

This image outlines what I commented out: https://i.stack.imgur.com/emRNC.jpg

As mentioned, commenting out that middleware prevented it from loading any new data but the current graphs had no issues being displayed. This confirmed my suspicion that corsheaders was the sole problem.

Now I had a bit more time to research the issue at home and realized that the crux of the issue is the fact that the middleware is what calls on the apps import:

https://i.stack.imgur.com/fLvaK.jpg

Now I will admit that while I have some python experience, I have no experience with Django and I have no idea how its apps work or what that import is doing. I ran

find /path/to/django/ -name "apps"

and also,

find /path/to/django/ -name "apps.py"

and I got 0 hits. I'm not even sure that this django.apps exists in Django 1.3.1 which is what this client is running along with python 2.6.6

I have already considered an upgrade but there are loads of other applications running on the server that a python or django upgrade is out of the question. Is there any way to resolve this?

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
Kusnan
  • 135
  • 1
  • 10
  • Sorry, I couldn't figure out a solution - but think you might want to check this post -> https://stackoverflow.com/questions/35760943/how-can-i-enable-cors-on-django-rest-framework – sahutchi Jan 29 '19 at 21:39
  • Please paste the code snippets and errors in here instead of using imgur. It makes your question difficult to read. – dirkgroten Jan 29 '19 at 21:48
  • 1
    I don't know much about Django 1.3, it's very ancient (and not supported for years, so full of security issues that haven't been fixed). It looks like someone updated django-cors-headers on your machine (current version supports only python > 2.7, Django > 1.8). It also looks like your application is not running in its own python virtualenvironment which doesn't isolate it from this kind of update. Sorry, but your server looks like a mess because you shouldn't be running a django app this way. – dirkgroten Jan 29 '19 at 21:56
  • 1
    If you could find the original version of corsheaders that was used, you could create a virtualenv for your project, isolating it from other projects. But it won't be easy to find the old versions of all used packages. We're talking about a version of django that lost extended support 6 years ago and was released 9 years ago! check `pip freeze` to see which versions of pip packages are installed. And maybe there's a `requirements.txt` file (or similar) in the project, usually top-level, to list which versions of packages are required. – dirkgroten Jan 29 '19 at 22:00

1 Answers1

0

No resolution found and the server is being decommissioned. Good riddance :)

Kusnan
  • 135
  • 1
  • 10