Superuser creation skipped due to not running in a TTY

I’ve deployed a number of Django apps previously and haven’t had this issue. But I’m getting it repeatedly now across several different projects.

After deploying a project and then migrating the database fly ssh console -C "python /code/manage.py migrate" I run fly ssh console -C "python /code/manage.py createsuperuser". This has worked the last few months with otherwise identical projects.

But I now get Superuser creation skipped due to not running in a TTY. You can run manage.py createsuperuser in your project to create one manually. Whether it’s on my projects or even @katia’s recent one.

Are others getting the same error? I’m unclear what exactly has changed.

Hey @wsvincent, if you add the --pty flag to fly ssh console it should work like before.

A few weeks ago we adjusted fly ssh console to work more in line with OpenSSH and not allocate a pseudoterminal by default when a command is given (-C), since it was tripping up some users who were trying to pipe data in or out of fly ssh console -C ... (like they might with regular old ssh). I authored this change, and unfortunately it was more disruptive than I expected. My apologies for this!

EDIT: createsuperuser requires a pseudoterminal because it prompts for a password. I believe that migration should work fine without one, though.

1 Like

Thanks @MatthewIngwersen for the quick response. Confirmed that fly ssh console --pty -C "python /code/manage.py createsuperuser" works.

Is there a changelog I can subscribe to, to find out about breaking changes like this. (or can you stop making breaking changes)

This broke some automated scripts and interactive consoles for my Rails app too - I’ve spent mucho time trying to figure out what I’ve broken in my app, or what gem I upgraded that broke this.

1 Like

Hello.
Now on 3 March 2024 again
the command: fly ssh console --pty -C “python /code/manage.py createsuperuser”
does not work
some one can help me ?

thank in advance

Hi @Alex-LG—just to clarify, you are seeing the same error message (“superuser creation skipped due to not running in a TTY”) as the others in this thread? Could you also let us know what flyctl version you are running (output of the fly version command)?

Yes it is , I see : “superuser creation skipped due to not running in a TTY”,
besides I add -a parameter.
My fly version: v0.2.8

@Alex-LG sorry for the delay, but I found some time to look into this, and unfortunately I can’t reproduce it yet. I tried with both flyctl v0.2.8 and the latest version (v0.2.11), with a fresh Django 5 app.

Perhaps you could try fly ssh console without any arguments to get a shell on your Machine, and then try running the manage.py command after it’s logged in? You can also try the tty command (if it’s available in your application image) to double-check whether your commands are running in a TTY.