Python manage py createsuperuser error

‘python manage.py createsuperuser’ error

I mostly followed the official documentation from this link In your django app folder create python package ‘management’ create another package inside management package ‘commands’ create a python file in commands package mysuperuser.py In your django-migrate.config file, add a second command do python manage.py collectstatic and eb deploy. Solution 2: For Windows CMD console you should do this steps (if you use virtual environment): c:\Path_to_you_App\venv\Scripts\activate (venv) cd c:\Path_to_you_App (venv) c:\Path_to_you_App>python manage.py createsuperuser Solution: There is no difference between creating superuser on local server and production server.

‘python manage.py createsuperuser’ error

I believe you tried to run this inside an IDE or some other environment which is not a TTY. Django expects the command to be run from a TTY compatible shell.

Run the command on your Windows command prompt, outside your editor/IDE. It should work.

  • https://askubuntu.com/questions/481906/what-does-tty-stand-for
  • https://unix.stackexchange.com/questions/4126/what-is-the-exact-difference-between-a-terminal-a-shell-a-tty-and-a-con
  • http://www.linusakesson.net/programming/tty/

For Windows CMD console you should do this steps (if you use virtual environment):

  1. c:\Path_to_you_App\venv\Scripts\activate
  2. (venv) cd c:\Path_to_you_App
  3. (venv) c:\Path_to_you_App>python manage.py createsuperuser

Not able to create super user in Django, Virtualenv, Superuser creation skipped due to not running in a TTY. You can run `manage.py createsuperuser` in your project to create one manually.

Читайте также:  Javascript request header get

Unable to create superuser in django due to not working in TTY

Django error: superuser creation skipped due to not running in a TTY. You can run manage.py
Duration: 1:23

Unable to create super user in django on my online server

There is no difference between creating superuser on local server and production server. You have to do next:

  1. Enter your server via ssh.
  2. Go to your project root folder (with manage.py file)
  3. Type python manage.py createsuperuser (use your virtual environment or system interpreter, depends on).

Force.com sites site guest user can’t see custom object, Superuser creation skipped due to not running in a TTY. You can run `manage.py createsuperuser` in your project to create one manually.

Django createsuperuser not working due to TTY error

Try to run the command inside a terminal with the path to manage.py as your working directory.

“Superuser creation skipped due to not running in a TTY. You can, Superuser creation skipped due to not running in a TTY. You can run `manage.py createsuperuser` in your project to create one manually. whatever by Nutty

Not able to create django superuser in aws beanstalk either through container command or manage.py

I solved this problem recently with one of my sample app deployment in beanstalk. I mostly followed the official documentation from this link

  1. In your django app folder create python package ‘management’
  2. create another package inside management package ‘commands’
  3. create a python file in commands package mysuperuser.py
import os from django.core.management.base import BaseCommand from django.contrib.auth.models import User class Command(BaseCommand): def handle(self, *args, **options): if not User.objects.filter(username='myuser').exists(): User.objects.create_superuser('myuser', 'myuser@myemail.com', 'mypassword') 

Doing this created the superuser for me.I didn’t have to add any PYTHONPATH as described in some answers available online.

Your custom file is named «createsuperuser.py» that’s the same as the Django command, and that collision is what’s causing the issue. Use «createsu.py» for the file name, then be sure to change the config file to also use «createsu.»

I spent ages working out how to do this and this is by far the simplest & most secure way. Create the following file .platform > hooks > postdeploy > 01_migrate.sh and input the below:

#!/bin/bash source /var/app/venv/*/bin/activate &&

You can then add DJANGO_SUPERUSER_PASSWORD , DJANGO_SUPERUSER_USERNAME , DJANGO_SUPERUSER_EMAIL to the configuration section of the application environment and it will know these are to be used as we have specified —noinput .

Then add the below to the folder .ebextentions > django.config . This just gets round permission issues in running 01_migrate.sh

container_commands: 01_chmod1: command: "chmod +x .platform/hooks/postdeploy/01_migrate.sh" 

That will create your superuser in a secure way, with the same logic you can also run migrations and collect static by adding to the 01_migrate.sh file.

Create superuser djangoSuperuser creation skipped due to not, Superuser creation skipped due to not running in a TTY. You can run `manage.py createsuperuser` in your project to create one manually. whatever by Nutty

Источник

Ошибка создания суперпользователя в Django

Я пытаюсь создать суперпользователя, чтобы получить доступ к инфраструктуре администратора Django в моем приложении. Я использую Vagrant на машине Windows 8.1:

Traceback (most recent call last): File "./manage.py", line 10, in execute_from_command_line(sys.argv) File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, i n execute_from_command_line utility.execute() File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, i n execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in ru n_from_argv self.execute(*args, **options.__dict__) File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in ex ecute output = self.handle(*args, **options) File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsu peruser.py", line 141, in handle self.UserModel._default_manager.db_manager(database).create_superuser(**user_data) File "/vagrant/myapp/accounts/managers.py", line 52, in create_superuser return self._create_user(email, password, True, True, **extra_fields) File "/vagrant/myapp/accounts/managers.py", line 31, in _create_user user.set_slug() File "/vagrant/myapp/accounts/models.py", line 164, in set_slug slug = slugify(self.username, max_length=50).lower() File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/slugify/main.py", line 101, in slugify text = join_words(words, separator, max_length) File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/slugify/main.py", line 78, in join_words text = next(words) # text = words.pop(0) StopIteration 

Я читал в другом месте (здесь) и (здесь), что это проблема «локали», но я понимаю, что это ошибка OSX, и я нахожусь в бродяжной виртуальной машине.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run python manage.py createsuperuser? #25

How to run python manage.py createsuperuser? #25

Comments

please help me, i wan to create superuser, how to create it ? thank you

The text was updated successfully, but these errors were encountered:

Me again, I tried running that command and I get this error:

docker-compose run backend python manage.py createsuperuser

Successfully created a user — one more question. How do I access the vue-cli from docker?

docker-compose run frontend your command> # for example: docker-compose run frontend npm run lint

Okay awesome! It worked — thank you so much for helping me out.

docker-compose run backend python manage.py createsuperuser

gives me ERROR: No such service: backend

both commands don’t work for me. Any other ideas?

Nevermind I found a solution

First ran this migrate command — this is the only one that worked for in a docker container:
sudo docker-compose run web python manage.py migrate

Then ran this command:
docker exec -it python manage.py createsuperuser

Although this issue is closed long time ago
But as for me using latest docker(unsure which version)
I simply run a create_admin.py using
CMD [ «python», «create_admin.py»]
in that create_admin.py

from django.contrib.auth import get_user_model User = get_user_model() User.objects.create_superuser('admin', 'admin@gmail.com', 'admin')

Just for some reference and some random comment.
Hope this helps.

Screenshot (220)

this worked for me. i m using docker and was unable to create superuser with
===> docker-compose run app sh -c «python manage.py createsuperuser»

Nevermind I found a solution

First ran this migrate command — this is the only one that worked for in a docker container:
sudo docker-compose run web python manage.py migrate

Then ran this command:
docker exec -it python manage.py createsuperuser

Источник

Оцените статью