新起了环境,创建models.py 内容,想要同步到数据库,执行以下操作时 报错:

./manage.py makemigrations
./manage.py migrate

*(第一个步骤为在该项目(app)下建立migrations目录,并记录关于models的内容及改动,第二部将改动记录到数据库文件,比如产生table)

报错代码:

ImportError: 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?

解决问题:

版本问题,执行以下操作

pip install -U django==1.8

再执行数据库同步就没有问题了~

Django同步数据库(/manage.py makemigrations) 报错的更多相关文章

  1. django 执行 python manage.py makemigrations 报错

    RuntimeError: Model class app_anme.models.xxx doesn't declare an explicit app_label and isn't in an ...

  2. Django :执行 python manage.py makemigrations 时报错 TypeError: __init__() missing 1 required positional argument: 'on_delete'

    原因 执行命令 python manage.py makemigrations 报错 TypeError: __init__() missing 1 required positional argum ...

  3. python2 + selenium + eclipse 中,通过django生产数据库表的时候报错

    python2 + selenium + eclipse 中,通过django生产数据库表的时候报错 解决: 1.查看自己电脑中,“开始-->控制面板-->管理工具-->服务--&g ...

  4. 执行python manage.py makemigrations时报错TypeError: __init__() missing 1 required positional argument: 'on_delete'

    在执行python manage.py makemigrations时报错: TypeError: __init__() missing 1 required positional argument: ...

  5. Django 中 python manage.py makemigrations 与 python manage.py migrate

    执行 python manage.py makemigrations django根据settings.py里面的INSTALLED_APPS项设置找到对应app里的models.py,应用里面创建的 ...

  6. python3.9 manage.py runserver 报错问题解决

    报错信息如下 You have 13 unapplied migration(s). Your project may not work properly until you apply the mi ...

  7. python manage.py syncdb报错:No module named MySQLdb

    今天同步数据时出现这个错误: 解决方法: 1.先下载mysql-python 支持1.2.3-2.7版本 MySQL-python 1.2.3 for Windows and Python 2.7, ...

  8. 执行: python manage.py makemigrations报AttributeError: 'str' object has no attribute 'decode'

    找到错误代码(line146):query = query.encode(errors='replace') 解决方法:把decode改为encode即可.

  9. manage.py migrate 报错

    第一个提示,setting里面的 STATICFILES_DIRS = (  os.path.join(BASE_DIR,'static')) 第二行的后面加','解决,这样可以被识别是tuple. ...

随机推荐

  1. superrvisor application config ini

    1. zookeeper [program:zookeeper] environment = JAVA_HOME="/opt/jdk1.8.0_191" process_name= ...

  2. 爬虫基础线程进程学习-Scrapy

    性能相关 学习参考:http://www.cnblogs.com/wupeiqi/articles/6229292.html 在编写爬虫时,性能的消耗主要在IO请求中,当单进程单线程模式下请求URL时 ...

  3. Linux配置Supervisor 配置遇到的坑

    在linux中web 应用部署到线上后之后发现退出终端后网站就无法访问了 所以需要用Supervisor来守护进程,它可以保证应用一直处于运行状态,在遇到程序异常.报错等情况,导致 web 应用终止时 ...

  4. [UGUI]Image源码分析

    unity版本5.3.5 一.属性 1.overrideSprite 脚本对精灵的访问均使用overrideSprite,如果m_OverrideSprite存在就使用m_OverrideSprite ...

  5. 插件: Hammer.js

    官网: http://hammerjs.github.io/  hammer.js 官网 http://hammerjs.github.io/api/ 官网API(官网写的实在太简了!不好用.注意里面 ...

  6. C#中EXCEL表格的内容进度条实现

    public void ExportToExcel() { DataTable dt = getDataTable(); if (dt == null) { MessageBox.Show(" ...

  7. grep -A -B -C 显示抓取的前后几行参数

    我经常用grep找东西,比如用户名和密码.大部分站点和用户名和密码都是在一样的,方便grep查找.有时,为了文本好看,我会放在多行.比如 wikipedia多个语言版本上有多个账号,就放在wikipe ...

  8. leetcode31

    class Solution { public: void nextPermutation(vector<int>&nums) { int len = nums.size(); , ...

  9. leetcode297

    public class Codec { // Encodes a tree to a single string. public string serialize(TreeNode root) { ...

  10. 用java语言构建一个网络服务器,实现客户端和服务器之间通信,实现客户端拥有独立线程,互不干扰

    服务器: 1.与客户端的交流手段多是I/O流的方式 2.对接的方式是Socket套接字,套接字通过IP地址和端口号来建立连接 3.(曾经十分影响理解的点)服务器发出的输出流的所有信息都会成为客户端的输 ...