Django createsuperuser not working due to TTY error - python

In django after populating the database, I started superuser creation but it fails and shows the error. Since I'm new to django and I cannot understand what is the error is about?
python manage.py createsuperuser
Error:
Superuser creation skipped due to not running in a TTY.
You can run `manage.py createsuperuser` in your project to create one manually.

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

Related

Can I make changes in manage.py?

I am doing a django project where I want my manage.py to run the server automatically(python manage.py runserver command) if its called. I believe that manage.py uses "execute_from_command_line". So is it possible or I have to find some other way to solve my problem.
I want my manage.py to run the server automatically

How can I keep the django server still running after close Command Prompt

I'm new to Django Project. I try to run the server with the command: python manage.py runserver in cmd. However, when I close the cmd, the server also closes too. So is there any way to run a django server and keep it running continuously even if I close the cmd? I'm using Windows. Thanks in advance.
I already tried some solutions like adding a "&" symbol (python manage.py runserver &), but it is not working.

Why can't I run "python manage.py startup APP_NAME" with django?

I'm trying to build a Django app, but it doesn't let me startup the app so I can bring it to the development server. I run python manage.py startup APP_NAME, where I expect the app to run. Instead, I get an error saying there is no such file or directory called manage.py. However, I have it open.
Is there a reason for this?
Perhaps what you need to ensure on your terminal what is the directory your project is located, by using command prompt "ls" if you are using Linux, or dir on Windows, then you need to activate your virtual environment using source virtual_env_name/bin/activate... then you can execute python manage.py
You need to run:
python manage.py startapp APP_NAME
to create new app in django

Django can't find user with 'python manage.py changepassword'

I've got some code (using Python 3.4, Django 1.7, and PostgreSQL) that I pushed to Heroku. Everything worked fine until I added a login. Just like on my local machine, I used the shell to add a user, create a password, and save the user/password. That pattern worked locally, even with foreman.
The setup that seems to have worked:
heroku run python3 manage.py shell
a = User.objects.get(id=1)
a
The server returns
<User: {'username':'Me'}>.
Asking for a.password returns a hashed password that changes when I do a.set_password('Blah') and then a.save().
That's all good and normal, except that the username/password (unhashed) won't log me in. When I run:
heroku run python3 manage.py changepassword Me
Heroku responds with:
CommandError: user 'Me' does not exist
How can a user be saved and retrievable in the shell, implying it's in the database, but not be found otherwise using "manage.py changepassword"?
Most importantly, how can I log into my website on Heroku?
****Edit****
I ran python manage.py createsuperuser in the Heroku shell to create a user so I could log in. Once I did, I saw that none of my CSS loaded. I'm not sure how that's related, but two big problems at the same time make me suspicious that it's something totally unrelated.

Error in running commands with manage.py

I just started learning django by using tango with django.
I did everything up till creating django project.
The problem I have is running with "manage.py" file.
When I ever I type
$ python manage.py runserver
it says
python: can't open file'manage.py'
So I tried
$ python c:\Users\<username>\tango_with_django_project\manage.py runserver
then it worked. Is there any way that I can run manage.py without typing long line like second one?
thanks
If you don't want to type each time, when you to run django dev server, just create .bat file (if you use Windows, as I can see) with this (working) string.
After that you need only double-click on this file to run server.
Did you changed current dir to the django project?
c:
cd \Users\<username>\tango_with_django_project\
python manage.py runserver

Categories