Problem in hosting Django REST API on IIS - django

I was trying to host django REST API on IIS but it wasn't working properly. I worked with the same locally and it was working absolutely fine.
But when I hosted it on IIS then first of all its homepage with get method for all data from the database takes longer time to load and ended up with timeout error. And, when I tried to access other pages, the same problem occurred with them too. Only a page with post method opened but when I tried to submit data it raised an error.
I checked server configuration then I found that default error is timeout error. Now I am confused about why such things happened.
Can anyone please tell me if they faced similar issue or if they know some kind of compatibility issue or some prerequisite for hosting REST API using Django REST Framework? Or help me how can I find and fix the issue.

Are you using FastCGI? check the Authentication then try to disable windows authentication and enable anonymous authentication, try that if it will work.

Related

Django REST Knox Authentication Issues

I've completed the development work on a Django REST API using Knox-Rest. It works great in my development environment but after moving it to the Prod environment, it authenticates users and returns a token back. Then using Postman, to test the API, I execute a GET using the returned token, I get a 401 error, Credentials Not Provided.
Looking at the "knox_authtoken" table, I see separate rows for each login. On the same table in development, I just see one row per user. I believe the answer to why it's not working is related to what I'm seeing on the table but I'm not sure what it's telling me.
All of the code is identical so it's likely in the setup but I can't seem to track it down. So anyone with some experience with the Django Knox-REST API that might have some ideas, I'd really appreciate it.
If Django is behind an Apache Webserver you'll need to enable WSGIPassAuthorization

How to make Django pass cookies when communicating with Node.js server using socket.io?

I am currently developing an instant messaging feature for my apps (ideally cross platform mobile app/web app), and I am out of ideas to fix my issue.
So far, I have been able to make everything work locally, using a Node.js server with socket.io, django, and redis, following what most tutorials online suggest.
The step I am now at consists in putting all that in the cloud using amazon AWS. My Django server is up and running, I created a new separate Node.js server, and I am using Elasticache to handle the Redis part. I launch the different parts, and no error shows up.
However, whenever I try using my messaging feature on the web, I keep getting an error 500:
handshake error
I then used the console to check the request header, and I observed that the cookies are not in there, contrary to when I am on localhost. I know it is necessary to authorize the handshake, so I guess that's where my error is coming from..
Furthermore, I have also checked that the cookies do exist, they are just not set in the request header.
My question is then: How can I make sure Django or socket client (not sure who's responsible here..) puts the cookies in the header??
One of my ideas was that maybe I am supposed to put everything on the same server, with different ports, instead of 2 separate servers? Documentation on that specific architecture problem is surprisingly scarce, compared to the number of tutorials describing how to make it work on local.
I hope I described the problem accurately enough! :)
Important note: I am using socket.io v0.9.1-1, only one compatible with a titanium mobile app.
Thank you for any help!
All right, so I've made some progress.
The cookie problem came from the fact I was making cross-domain request, adding a few lines enabled CORS, which didn't solve the cookie issue, but allowed me to communicate between servers (basically I set the headers of the response using express. I then passed necessary data in the query, even if not the most secure way to do it, I'm just building an MVP, and it's enough for now.
I haven't been able to make the chat work from my Titanium mobile app, but since I can use a webview to handle it, I will be fine.
Hopefully that will help someone.. If anyone needs me to post some code snippets I will gladly do so upon request!
Cheers

I am getting ![CDATA[ Internal error. To see this error please display the PHP errors. error in Prestashop

I am new to Prestashop. Please help me. I was trying to use webservices but I am receiving this error. What should I do? I am using Prestashop 1.5.
You need to set _PS_MODE_DEV_ to true. This file is found at config/defines.inc.php.
Once this flag is enabled, you will see a useful error message instead of the generic one.
See Add product to PrestaShop 1.5 via Web Service for where I found this tip.
Check all the configuration before running web application. Make sure Webservice is enabled in the back office.:)
Internal error, may be you missing some configuration. Check all the configuration before running web application.

External request limit on IIS

I have deployed django application on IIS. The application requests external link (API) to extract some data.
What I have seen is, it makes requests but fails to complete full request. It goes for about 4 request sometimes it goes further 9 requests and stops there. No sign of error is shown.
While I perform same task from django shell, all requests are made. So I guess this is something related to IIS.
I am new to IIS and windows server app deployment.
I tried googling about this but I could not find any relevant answer.
Did anyone of you here faced similar problem? If so what can be the solution. Also can you guide me on this?

Django Allauth and Google

I've tried to add google login to my web application using django-allauth.
I added to my google application the following callback_uri:
"http://localhost:8000/accounts/google/login/callback"
since i'm running tests on my development server (localhost) and i don't wanna use https.
Even though, i get a 'redirect_uri_mismatch' saying that my redirect URI doesn't match any registred redirect URI.
Does anyone have any ideea about what causes this?
Thanks for your time.
Later Edit:
Using 127.0.0.1 instead of localhost solved this problem.
Recently I ran into problems trying to get Google+ to work as well. I finally got it working. I made some updates to the documentation so it's a bit easier to use. See if using the updated allauth google docs you can get it to work.
Have you try doing the following:
1. Go to the Google Developers console -> Api $ auth -> credentials
2. You should see "Client ID for web application" click "Edit Settings"
3. Change your "Redirect URI" to "http://localhost:8000/accounts/google/login/callback"
Should work after that let me know if it doesn't.
Cheers,
Dan