flyctl launch for new django app has no follow-up link

I’m running flyctl launch for the first time to deploy a django app.

Everything was detected correctly and the app is now pending. BUT, the final line says
For detailed documentation, see

That URL doesn’t work, and AFAICT you don’t have a detailed doc guide for django, so it leaves the user hanging with a pending app and no clear next step.

Thanks for the feedback. Not sure how that slipped in, as we don’t have a Django guide, but we’ll either update that link or add a guide :slight_smile:

Did your app end up deploying correctly?

1 Like

Not yet. For some reason secrets aren’t making it through? I have things like DJANGO_ENV set as a secret, but os.environ[‘DJANGO_ENV’] doesn’t show it existing when the app runs during a flyctl deploy

EDIT: This is during the dockerfile step RUN python collectstatic --noinput . Does that not get the secrets list?

Secrets are not available in Docker builds. You can set build arguments which then can be referenced in Dockerfile by adding an ARG entry before your RUN.


I can confirm that you should be able to pull secrets using django-environ, which is what I’m doing, although I added DJANGO_ENV to fly.toml instead of secrets:

  DJANGO_ENV = "production"

This has been really helpful. I didn’t realize the difference between the build and run environments before, though it makes sense.

@bman , I’m curious how you detect development vs build vs prod from within the django app. Especially how you separate build from prod. So far, I’m using another env variable defined in the Dockerfile that signals build-phase, which is then overwritten by the same variable name in secrets. But that feels kinda janky.

I split my settings into,, and In, I check for DJANGO_ENV which I’ve set in fly.toml:

if os.environ.get('DJANGO_ENV') == 'production':
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bman.settings.production')

If production is detected, it uses django-environ in to access secrets.

1 Like