question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Django] Plugin assumes app is in current directory

See original GitHub issue

I’m using serverless to deploy a Django (REST Framework) API as an AWS Lambda function, and I’m also going to be deploying other Lambda functions that are not WSGI apps. I have this all in one repo right now, with serverless.yml alongside api, where api is the Django project directory.

Thus, I set custom.wsgi.app: api.api.wsgi.application. This allows the WSGI handler to find my app just fine, but when the app runs, it appears that the working directory is still the root of my repo, rather than the root of the Django app, because I get an import error on api.settings. I get the same error message when deploying the endpoint to AWS and testing there.

Sorry if this is misfiled; I’m not sure if this is a question about Django, serverless, or serverless-wsgi, as I’m new to all of them. 😃 Is there a way to make sure the function that runs my Django app from a working directory other than where serverless.yml lives? Is that up to serverless or serverless-wsgi, or Django?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
brettdhcommented, Aug 17, 2017

Nope; same error.

I’ll take a moment to make a repro project.

0reactions
logandkcommented, Aug 29, 2017

I’m closing this and releasing 1.3.0 now

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get absolute path of django app
Python modules (including Django apps) have a __file__ attribute that tells you the location of their __init__.py file on the filesystem, so
Read more >
Writing your first Django app, part 1
The outer mysite/ root directory is a container for your project. · manage.py : A command-line utility that lets you interact with this...
Read more >
Writing your first Django app, part 1
This will create a mysite directory in your current directory. ... In this tutorial, we'll create our poll app right next to your...
Read more >
How to override templates
These settings assume you have a templates directory in the root of your project. To override the templates for the blog app, create...
Read more >
django-admin and manage.py
Run django-admin version to display the current Django version. ... This command assumes the programs are on your PATH so that a call...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found