码迷,mamicode.com
首页 > 其他好文 > 详细

创建项目报错解决方法

时间:2020-03-06 17:12:45      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:安装   启动   tor   auto   properly   min   entry   apply   python   

1、安装django
2、配置django的环境变量
C:\Users\huojia\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\django
3、运行命令行创建django项目
选好目录,执行django-admin startproject mysites项目名称
项目就被创建了,但是报错,Couldn‘t import Django. Are you sure it‘s installed and available on your PYTHONPATH environment variable? Did you
forget to activate a virtual environment?
4、卸载django版本,重新安装,没有生效
    pip3 uninstall django
    pip3 install django
5、cmd启动程序python3 manage.py runserver 127.0.0.1:8001
报以下错误,说没有权限
You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run ‘python3 manage.py migrate‘ to apply them.
February 24, 2020 - 17:22:31
Django version 3.0.3, using settings ‘mysites.settings‘
Starting development server at http://127.0.0.1:8001/
Quit the server with CTRL-BREAK.
6、运行‘python3 manage.py migrate‘ to apply them.
D:\python\mysites>python3 manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying sessions.0001_initial... OK

创建项目报错解决方法

标签:安装   启动   tor   auto   properly   min   entry   apply   python   

原文地址:https://www.cnblogs.com/meihan/p/12427487.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!