python manage.py shell
如果这个时候报错:
python: can‘t open file ‘manage.py‘: [Errno 2] No such file or directory
你设置了环境变量,但是就是报错,为啥呢?
我找了很长时间,最后在这里找到答案:https://www.pythonanywhere.com/forums/topic/756/,意思就是说,你要cd到你的项目下边(你的项目下边应该有manage.py文件),然后再运行:python manage.py shell
然后获取你的用户名,并且重设密码:
from django.contrib.auth.models import User user = User.objects.get(username=‘admin‘) user.set_password(‘new_password‘) user.save()
原文:http://my.oschina.net/muyexia/blog/396029