How to “reset” a postgres database on PythonAnywhere?

ⅰ亾dé卋堺 提交于 2021-02-11 14:16:17

问题


After some testing with Django on PythonAnywhere, I want to get rid of my testing data before I import my actual data to the postgres database. I thought the best way would be to start from scratch and "reset" somehow the database.

Unfortunately there is no button for that on pythonanywhere.com and the documentation does not say anything.

So the question is: how can I "reset" or empty the postgres database on PythonAnywhere?


回答1:


With the help of the PythonAnywhere support I found a way which worked for me: I deleted and re-created my database (called postgres) as follows:

Open a bash console (not a virtualenv console!) and execute the following commands:

dropdb -h xxx.postgres.eu.pythonanywhere-services.com -p 10077 -U super postgres
createdb -h xxx.postgres.eu.pythonanywhere-services.com -p 10077 -U super postgres

(replace above xxx with your data)



来源:https://stackoverflow.com/questions/64759855/how-to-reset-a-postgres-database-on-pythonanywhere

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!