1

I'm neewbie in pythonanywhere. I've just deploy my django project and all seems to be OK except I need initialize ma database first and I don't know how to do this. I can I get a python shell?

thanks for help

1
  • did you checked their dashboard ? Commented Sep 3, 2020 at 15:06

2 Answers 2

1

To initialize your database in django first you want to type:

python manage.py makemigrations

then type:

python manage.py migrate

Hope this helps, if you still do not understand check the django documentation:

https://docs.djangoproject.com/en/3.1/intro/tutorial01/ https://docs.djangoproject.com/en/3.1/intro/tutorial02/

read page 1 and 2 of the django tutorial

Sign up to request clarification or add additional context in comments.

3 Comments

thanks both. Maybe I was not clear enought ; ) I have my database create (with migrate) but need to 'populate' my database... til now, I've open a python shell and create some records... and now I will do it with Django admin ... not really convenient
You need to create a superuser with the python shell by typing python manage.py createsuperuser than enter some credentials, next login to django admin via going to your website which i think would be 127.0.0.1:port/admin and logging in to django admin, from their you should be able to see the database with the users you creates. I hope this answers your question.
Use the credentials you made with python manage.py createsuperuser to login to the django admin page
0

You can log in with SSH and then you will be able to populate your database through the command line or a shell

ssh <username>@ssh.pythonanywhere.com

Look at: https://help.pythonanywhere.com/pages/SSHAccess

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.