django-rest-framework-api-key | extra layer of authentication for Web APIs | REST library
kandi X-RAY | django-rest-framework-api-key Summary
kandi X-RAY | django-rest-framework-api-key Summary
An extra layer of authentication for Web APIs made with Django REST Framework
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Save the API key
- Generate a random key
- Check if user has permissions
django-rest-framework-api-key Key Features
django-rest-framework-api-key Examples and Code Snippets
private int solveJosephusProblem(List soldiers, int k, int index) {
/**
* Base Case.
*/
if (soldiers.size() == 1) return soldiers.get(0);
int killIdx = (index + k) % soldiers.size();
soldiers.remove(killIdx);
return so
protected Individual getFittest() {
Individual fittest = individuals.get(0);
for (int i = 0; i < individuals.size(); i++) {
if (fittest.getFitness() <= getIndividual(i).getFitness()) {
fittest = getIn
Community Discussions
Trending Discussions on django-rest-framework-api-key
QUESTION
I'm running a DJango App through and Elastic Beanstalk Environment that is setup to scale to multiple instance when the server load reaches a certain level.
The Django APP is being used as a REST API (DRF) and I have the django-cors-headers [https://github.com/ottoyiu/django-cors-headers] app installed to handle requests from an Ionic Application. Requests are being made through Angular2's http framework, which makes pre-flight requests.
The application and requests work fine when there is only one instance running. However when Elastic Beanstalk starts up a second server because it has hit it's limits all of the requests start failing. Requests that don't require authentication fail just the same as requests that do. If I make the request via Postman it works fine. So it has to be something to do with the CORS configuration.
The API is using the https://github.com/manosim/django-rest-framework-api-key framework to provide a API Key so this is also part of the setup.
I've been looking through the web and have tried virtually everything I could find. I tried setting the Headers manually in the apache configuration through ebextensions. I looked into ngnix settings, but wasn't sure what could be done there.
...ANSWER
Answered 2018-Feb-09 at 18:22I finally resolved this issue. It had nothing to do with CORS at all. The problem revolved around the Elastic Load Balancer health status. The health status was immediately returning as good before the Django application was successfully installed and spun up. Therefore my requests were trying to hit a service that wasn't even running. To resolve this issue I created a custom health check for the ELB.
- Create a Django View called health and just have it return a 200. You can make the url path be whatever you want. Mine is just /health
- Within your ELB configure the health check to use HTTP on PORT 80 and set the ping path to the url of your health page. (/health)
- Done.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install django-rest-framework-api-key
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page