求解 我利用Django中的命令:migrate 结果显示找不到此文件

求解 我利用Django中的命令:python manage.py migrate 结果 can't open file 'manage.pymigrate': [Errno 2] No such file or directory 请问如何解决?已经有环境了,在Mac终端运行的

2个回答

最后面缺了个参数,后面跟的是你的app名字,想用的话再加其他参数。

第一步要执行:python manage.py makemigrations 这个命令会在migrations文件夹内生成迁移文件
第二步采取执行:python manage.py migrate 这个命令会将迁移文件转化为sql语句在数据库中执行。

django真的是冷门,一起学习的可以关注我,一起学习。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Python+OpenCV计算机视觉

Python+OpenCV计算机视觉

Django报错:django.server:"GET /favicon.ico HTTP/1.1" 500 59,该如何解决?

搭建完HttpRunnerManager环境后进行接口的调试,运行用例时页面报错: A server error occurred. Please contact the administrator. ![图片说明](https://img-ask.csdn.net/upload/201908/14/1565747464_929466.jpg) 返回用例页面收到提示: ![图片说明](https://img-ask.csdn.net/upload/201908/14/1565747577_116158.jpg) 点击确定后页面依旧是500报错,和图一相同,刷新页面也无济于事 ![图片说明](https://img-ask.csdn.net/upload/201908/14/1565747927_436972.jpg) dos命令窗口关于django服务的报错: ![图片说明](https://img-ask.csdn.net/upload/201908/14/1565748112_123790.jpg) 分别查询了前台和后台的错误解决办法,发现前台错误和其他人的原因不同,后台django的错误实在搜不到详细的内容,本人也是初次接触这套框架,对django的报错没有头绪,希望有大佬帮忙分析一下原因所在,万分感谢。

Django写网站遇到IndexError: list index out of range问题求解

新手在尝试用django写电子商务网站时,需要展示某个用户的所有订单,遇到下图问题 ![图片说明](https://img-ask.csdn.net/upload/201903/04/1551675907_195552.png) ![图片说明](https://img-ask.csdn.net/upload/201903/04/1551675928_499054.png) views里544行前后代码如下 ![图片说明](https://img-ask.csdn.net/upload/201903/04/1551675956_763161.png) 各位大佬求解呜呜呜

求助 关于Django ,AttributeError:'Topic' object has no attribute 'owner'

python编程入门到实践第十九章中的问题 浏览器报错信息如下 ![图片说明](https://img-ask.csdn.net/upload/201904/04/1554356911_216497.png) **关于我的views.py 的代码如下** ``` from django.shortcuts import render from django.http import HttpResponseRedirect, Http404 from django.urls import reverse from django.contrib.auth.decorators import login_required from .models import Topic, Entry from .forms import TopicForm, EntryForm # Create your views here. def index(request): ''' 学习笔记的主页 :return: ''' return render(request,'learning_logs/index.html') def topics(request): """Show all topics.""" topics = Topic.objects.order_by('date_added') context = {'topics': topics} return render(request, 'learning_logs/topics.html', context) @login_required def new_topic(request): '''添加新主题''' if request.method != 'POST': form = TopicForm() else: form = TopicForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('learning_logs:topics')) context = {'form':form} return render(request,'learning_logs/new_topic.html',context) def edit_entry(request, entry_id): """Edit an existing entry.""" entry = Entry.objects.get(id=entry_id) topic = entry.topic if topic.owner != request.user: raise Http404 if request.method != 'POST': # Initial request; pre-fill form with the current entry. form = EntryForm(instance=entry) else: # POST data submitted; process data. form = EntryForm(instance=entry, data=request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('learning_logs:topic', args=[topic.id])) context = {'entry': entry, 'topic': topic, 'form': form} return render(request, 'learning_logs/edit_entry.html', context) def topic(request, topic_id): """Show a single topic, and all its entries.""" topic = Topic.objects.get(id = topic_id) # Make sure the topic belongs to the current user. if topic.owner != request.user: raise Http404 entries = topic.entry_set.order_by('-date_added') context = {'topic': topic, 'entries': entries} return render(request, 'learning_logs/topic.html', context) def new_entry(request, topic_id): """Add a new entry for a particular topic.""" topic = Topic.objects.get(id=topic_id) if topic.owner != request.user: raise Http404 if request.method != 'POST': # No data submitted; create a blank form. form = EntryForm() else: # POST data submitted; process data. form = EntryForm(data=request.POST) if form.is_valid(): new_entry = form.save(commit=False) new_entry.topic = topic new_entry.save() return HttpResponseRedirect(reverse('learning_logs:topic', args=[topic_id])) context = {'topic': topic, 'form': form} return render(request, 'learning_logs/new_entry.html', context) ```

新浪sae配置django出错 ImportError: No module named wsgi

Traceback (most recent call last): File "/data1/wwwdocs/799/mdqp/1/index.wsgi", line 2, in <module> from project0 import wsgi File "/data1/wwwdocs/799/mdqp/1/project0gi.py", line 27, in <module> from django.core.wsgi import get_wsgi_application ImportError: No module named wsgi index.wsgi代码: import sae from project0 import wsgi application = sae.create_wsgi_app(wsgi.application) config.yaml代码: name: mdqp version: 1 libraries: - name: "django" version: "1.5" 网上有人说是上面这段的空格格式 但是改了还是没用

uwsgi运行django项目ModuleNotFoundError: No module named 'Dotts.settings'?

在linux系统运行uwsgi+django项目可以运行 但是报错ModuleNotFoundError: No module named 'Dotts.settings' 求助

django operationalerror:no such table问题

![图片说明](https://img-ask.csdn.net/upload/201908/20/1566309101_99545.png) 数据库 ![图片说明](https://img-ask.csdn.net/upload/201908/20/1566309118_854760.png) 文件路径 ![图片说明](https://img-ask.csdn.net/upload/201908/20/1566309159_756269.png) admin界面 ![图片说明](https://img-ask.csdn.net/upload/201908/20/1566309201_944852.png) 运行过如下代码并且成功了 ``` python manage.py makemigrations python manage.py migrate ``` ![图片说明](https://img-ask.csdn.net/upload/201908/20/1566309301_942422.png)![图片说明](https://img-ask.csdn.net/upload/201908/20/1566309309_56608.png) 尝试过如下解决方案 ``` python manage.py makemigrations HERBS python manage.py migrate HERBS class Meta: managed = True ``` admin.py ``` from django.contrib import admin from HERBS.models import Herbs,DISEASE,Chemicals,CASID,TARGET class HerbAdmin(admin.ModelAdmin): search_fields = ('ID','NAME') list_filter = ('NAME','Function') list_display = ('ID','NAME','Function') class DISEASEAdmin(admin.ModelAdmin): search_fields = ('Disease','MolID') list_filter = ('Disease','MolID') list_display = ('Disease','MolID') class ChemicalsAdmin(admin.ModelAdmin): search_fields = ('ChemName','MolID','PubChemcid','ChineseName','Smiles') list_filter = ('MolID','ChemName') list_display = ('ChemName','MolID','PubChemcid','HID','ChineseName','MF','MW','Smiles') class CASIDAdmin(admin.ModelAdmin): search_fields = ('ID','MolID') list_display = ('ID','MolID') class TARGETAdmin(admin.ModelAdmin): search_fields = ('MolID','Target') list_display = ('MolID','Target') # Register your models here. admin.site.register(Herbs,HerbAdmin) admin.site.register(DISEASE,DISEASEAdmin) admin.site.register(CASID,CASIDAdmin) admin.site.register(Chemicals,ChemicalsAdmin) admin.site.register(TARGET,TARGETAdmin) ``` models.py ``` from django.db import models #Create your models here. class Herbs(models.Model): ID = models.DecimalField(max_digits=5,decimal_places=0) NAME = models.TextField(max_length=50,primary_key=True) Function = models.TextField(max_length=500,null=True) class DISEASE(models.Model): Disease = models.TextField(max_length=100) MolID = models.TextField(max_length=50) class Chemicals(models.Model): ChemName = models.TextField(max_length=50) MolID = models.TextField(max_length=50) PubChemcid = models.DecimalField(max_digits=10,decimal_places=0) HID = models.DecimalField(max_digits=10,decimal_places=0) ChineseName = models.TextField(max_length=50) MF = models.TextField(max_length=50) MW = models.DecimalField(max_digits=20,decimal_places=2) Smiles = models.TextField(max_length=500) class CASID(models.Model): ID = models.TextField(max_length=50) MolID = models.TextField(max_length=50) class TARGET(models.Model): Target = models.TextField(max_length=100) MolID = models.TextField(max_length=50) class Meta: managed = True ```

Django migrate的时候报错

migration可以,但执行migrate的时候就报错 models.py ``` class Category(models.Model): name = models.CharField('名称', max_length=16) class Tag(models.Model): name = models.CharField('名称', max_length=16) class Article(models.Model): title = models.CharField(max_length=32, default='Title') content = models.TextField(null=True) pub_time = models.DateTimeField(auto_now_add=True) author = models.CharField(max_length=16, default='Author') category = models.ForeignKey(Category, verbose_name='分类', default='Category') tags = models.ManyToManyField(Tag, verbose_name='标签') def __unicode__(self): return self.title class Comment(models.Model): blog = models.ForeignKey(Article, verbose_name='博客') name = models.CharField('称呼', max_length=16) email = models.EmailField('邮箱') content = models.CharField('内容', max_length=140) created = models.DateTimeField('发布时间', auto_now_add=True) ``` 下面是报错信息![图片说明](https://img-ask.csdn.net/upload/201804/07/1523113359_702807.png) 感觉可能是版本问题但是又不知道是哪的错,把Category的语句注释了也不行,求大神帮忙解答,感谢!

执行python manage.py migrate命令有问题

我在windows系统搭建了开发环境,使用的是pytohn2.7版本,在本地开发环境验证测试,执行python manage.py migrate命令有问题: 我在这个位置执行的命令: ![图片说明](https://img-ask.csdn.net/upload/201912/16/1576467780_425609.png) 报错如下: ![图片说明](https://img-ask.csdn.net/upload/201912/16/1576467889_633346.png) D:\python2.7\python2.7\Lib\site-packages\django\conf\project_template>python manage.py migrate Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "D:\python2.7\python2.7\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line utility.execute() File "D:\python2.7\python2.7\lib\site-packages\django\core\management\__init__.py", line 303, in execute settings.INSTALLED_APPS File "D:\python2.7\python2.7\lib\site-packages\django\conf\__init__.py", line 48, in __getattr__ self._setup(name) File "D:\python2.7\python2.7\lib\site-packages\django\conf\__init__.py", line 44, in _setup self._wrapped = Settings(settings_module) File "D:\python2.7\python2.7\lib\site-packages\django\conf\__init__.py", line 92, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "D:\python2.7\python2.7\lib\importlib\__init__.py", line 37, in import_module __import__(name) ImportError: No module named {{ project_name }}.settings 求大神指教,是我执行的目录位置有问题吗?

Django项目问题:数据库存空字符串怎么不报错?

user表继承自django自带的用户表,测试的时候发现一个问题 username字段没有重写,这个字段为什么能存空字符串? 要怎么设置呢?总不能每次存之前都判断是不是空吧? 前端没有填写username,后端拿到的是空字符串,这个存数据库的时候怎么不报错呢?

使用django-admin startproject 创建项目为什么老是出现“不是内部命令”的错误?

我使用的是Win10系统,在使用django-admin创建项目时老是出现”django-admin不是内部命令“错误提示。.py文件的默认打开方式是python.exe,但是还是出现同样的错误,求大神解答哦!!! 环境变量已经配置好了如下图: ![在这里插入图片描述](https://img-blog.csdnimg.cn/20200606090752807.PNG?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3h1Y2hhb19vcGVu,size_16,color_FFFFFF,t_70#pic_center) 然后在命令行输入“django-admin startproject mysite”,就报如下错误: ![在这里插入图片描述](https://img-blog.csdnimg.cn/20200606091031482.PNG?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3h1Y2hhb19vcGVu,size_16,color_FFFFFF,t_70#pic_center) 在网上找了很多解决办法,都试过了,可还是不行,请问大神们帮我解答一下是什么原因哦???

django OperationalError:no such table问题

admin界面有这些table ![图片说明](https://img-ask.csdn.net/upload/201908/20/1566306109_375484.png) 但任何一张表打开都是operationalerror ![图片说明](https://img-ask.csdn.net/upload/201908/20/1566306079_894027.png) 我的数据库 ![图片说明](https://img-ask.csdn.net/upload/201908/20/1566306954_557961.png) 文件路径 ![图片说明](https://img-ask.csdn.net/upload/201908/20/1566307025_838507.png) 运行过如下代码 ``` python manage.py makemigrations python manage.py migrate ``` ![图片说明](https://img-ask.csdn.net/upload/201908/20/1566306389_902239.png) ![图片说明](https://img-ask.csdn.net/upload/201908/20/1566306436_170968.png) 我觉得应该是运行成功了的 以下这些我找到的解决方法都试过了没有用 ``` python manage.py syncdb class Meta: managed = True python manage.py makemigrations HERBS python manage.py migrate HERBS ``` admin.py ``` from django.contrib import admin from HERBS.models import Herbs,DISEASE,Chemicals,CASID,TARGET class HerbAdmin(admin.ModelAdmin): search_fields = ('ID','NAME') #可进行查询的字段 list_filter = ('NAME','Function') #可进行筛选的字段 list_display = ('ID','NAME','Function') #需要在后台显示出来的字段 class DISEASEAdmin(admin.ModelAdmin): search_fields = ('Disease','MolID') list_filter = ('Disease','MolID') list_display = ('Disease','MolID') class ChemicalsAdmin(admin.ModelAdmin): search_fields = ('ChemName','MolID','PubChemcid','ChineseName','Smiles') list_filter = ('MolID','ChemName') list_display = ('ChemName','MolID','PubChemcid','HID','ChineseName','MF','MW','Smiles') class CASIDAdmin(admin.ModelAdmin): search_fields = ('ID','MolID') list_display = ('ID','MolID') class TARGETAdmin(admin.ModelAdmin): search_fields = ('MolID','Target') list_display = ('MolID','Target') # Register your models here. admin.site.register(Herbs,HerbAdmin) admin.site.register(DISEASE,DISEASEAdmin) admin.site.register(CASID,CASIDAdmin) admin.site.register(Chemicals,ChemicalsAdmin) admin.site.register(TARGET,TARGETAdmin) ``` models.py ``` from django.db import models #Create your models here. class Herbs(models.Model): ID = models.DecimalField(max_digits=5,decimal_places=0) NAME = models.TextField(max_length=50,primary_key=True) Function = models.TextField(max_length=500,null=True) class DISEASE(models.Model): Disease = models.TextField(max_length=100) MolID = models.TextField(max_length=50) class Chemicals(models.Model): ChemName = models.TextField(max_length=50) MolID = models.TextField(max_length=50) PubChemcid = models.DecimalField(max_digits=10,decimal_places=0) HID = models.DecimalField(max_digits=10,decimal_places=0) ChineseName = models.TextField(max_length=50) MF = models.TextField(max_length=50) MW = models.DecimalField(max_digits=20,decimal_places=2) Smiles = models.TextField(max_length=500) class CASID(models.Model): ID = models.TextField(max_length=50) MolID = models.TextField(max_length=50) class TARGET(models.Model): Target = models.TextField(max_length=100) MolID = models.TextField(max_length=50) class Meta: managed = True ```

Python 用终端创建django项目时 提示 command not found

用终端创建django项目时 提示 django-admin: command not found 但是运行Python 导入django又可以 这是哪里出错了 而且之前有创建成功过

Django已有的model表新增字段,执行migrate报错:django.db.utils.DatabaseError:ORA-00955: name is already used by an existing object,出现重名是啥情况。。。

Django已有的model表新增字段,执行migrate报错:django.db.utils.DatabaseError:ORA-00955: name is already used by an existing object,出现重名是啥情况。。。

在Linux下 安装Django后,import django不成功

``` cd Django-1.7.1 python setup.py install python >>> import django Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named django ``` ``` cd /usr/local/python2.7/lib/python2.7/site-packages/ ls Django-1.7.1-py2.7.egg easy-install.pth README setuptools-7.0-py2.7.egg setuptools.pth ``` ython是自己安装的2.7.5版本的,老的Python没有卸载,安装了Django以后,导入Django失败,求解。。。

django自定义用户模型使用的uid做主键,但是migrate报错默认id字段无效,django版本3.0.3

用户模型代码 ``` class UserModel(AbstractUser): first_name = None last_name = None gender = ( ('male', '男'), ('female', '女'), ('privacy', '不愿告知') ) uid = ShortUUIDField(primary_key=True) phone = models.CharField(verbose_name='手机号', max_length=11, blank=True) sex = models.CharField(verbose_name='性别', choices=gender, default='男', max_length=32) avatar = models.ImageField(verbose_name='头像', upload_to='avatar/', blank=True) class Meta: verbose_name = '用户' verbose_name_plural = verbose_name def __str__(self): return self.username ``` 报错代码 ``` django.db.utils.InternalError: (1067, "Invalid default value for 'user_post_id'") ```

求助:Nginx+Gunicorn部署 Django后遇到Not Found错误

问题描述: Nginx+Gunicorn部署 Django后遇到Not Found错误 ![图片说明](https://img-ask.csdn.net/upload/202003/09/1583754685_161046.png) 服务器版本:CentOS 7.5 x64 说明:在虚拟环境中使用django自带的runserver运行(0.0.0.0:8000)后,使用公网IP:端口/index可以正常访问项目,关闭debug后使用 ``` pipenv run gunicorn blogproject.wsgi -w 2 -k gthread -b 0.0.0.0:8000 ``` 运行也可以正常访问,但是开启nginx后运行就出现如图错误。 /etc/nginx/conf.d/django-blog.conf配置如下 ``` [zijeak@VM_16_8_centos conf.d]$ cat django-blog.conf server { charset utf-8; listen 80; server_name 119.27.169.70; location /static { alias /home/zijeak/apps/django-blog/static; } location / { proxy_set_header Host $host; proxy_pass http://127.0.0.1:8000; } } ``` 查看nginx日志如下: ``` [zijeak@VM_16_8_centos conf.d]$ sudo nginx -t [sudo] password for zijeak: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful ``` 项目目录如下: ![图片说明](https://img-ask.csdn.net/upload/202003/09/1583755294_598395.png)

Django升级后出现了ModuleNotFoundError: No module named 'Studentdjango' 请求大神帮忙看一下

![图片说明](https://img-ask.csdn.net/upload/201909/26/1569496534_51916.png)![图片说明](https://img-ask.csdn.net/upload/201909/26/1569496543_620157.png) 代码应该没什么问题,是看的教材上写的,不知道为什么把Django升级后,就 出现了这样的错误,想知道这应该是怎么解决啊

pycharm编写django项目导入pymsql报错:ModuleNotFoundError: No module named 'pymysql'

我是在阿里云服务器上简历的Django 项目,然后通过pycharm下载下来进行编写的。还没开始写项目呢,配置settings时,我在pycharm上在init里面导入了pymysql,没报错。但是在服务器上runserver的时候就报错了。我是小白,现在不知道咋努力,没有思路,各位大佬帮我看看

pyecharts +django 显示不出来关系图

单独运行pyecharts和django已成功 <br>view.py中:<br> ![图片说明](https://img-ask.csdn.net/upload/201904/07/1554635923_506622.jpg) <br> 在def test中调用: <br>![图片说明](https://img-ask.csdn.net/upload/201904/07/1554635988_828634.jpg) <br> 在test.html中直接有{{picdata}} 但是运行django后为空白页。

2019 Python开发者日-培训

2019 Python开发者日-培训

150讲轻松搞定Python网络爬虫

150讲轻松搞定Python网络爬虫

设计模式(JAVA语言实现)--20种设计模式附带源码

设计模式(JAVA语言实现)--20种设计模式附带源码

YOLOv3目标检测实战:训练自己的数据集

YOLOv3目标检测实战:训练自己的数据集

java后台+微信小程序 实现完整的点餐系统

java后台+微信小程序 实现完整的点餐系统

三个项目玩转深度学习(附1G源码)

三个项目玩转深度学习(附1G源码)

初级玩转Linux+Ubuntu(嵌入式开发基础课程)

初级玩转Linux+Ubuntu(嵌入式开发基础课程)

2019 AI开发者大会

2019 AI开发者大会

玩转Linux:常用命令实例指南

玩转Linux:常用命令实例指南

一学即懂的计算机视觉(第一季)

一学即懂的计算机视觉(第一季)

4小时玩转微信小程序——基础入门与微信支付实战

4小时玩转微信小程序——基础入门与微信支付实战

Git 实用技巧

Git 实用技巧

Python数据清洗实战入门

Python数据清洗实战入门

使用TensorFlow+keras快速构建图像分类模型

使用TensorFlow+keras快速构建图像分类模型

实用主义学Python(小白也容易上手的Python实用案例)

实用主义学Python(小白也容易上手的Python实用案例)

程序员的算法通关课:知己知彼(第一季)

程序员的算法通关课:知己知彼(第一季)

MySQL数据库从入门到实战应用

MySQL数据库从入门到实战应用

机器学习初学者必会的案例精讲

机器学习初学者必会的案例精讲

手把手实现Java图书管理系统(附源码)

手把手实现Java图书管理系统(附源码)

极简JAVA学习营第四期(报名以后加助教微信:eduxy-1)

极简JAVA学习营第四期(报名以后加助教微信:eduxy-1)

.net core快速开发框架

.net core快速开发框架

玩转Python-Python3基础入门

玩转Python-Python3基础入门

Python数据挖掘简易入门

Python数据挖掘简易入门

微信公众平台开发入门

微信公众平台开发入门

程序员的兼职技能课

程序员的兼职技能课

Windows版YOLOv4目标检测实战:训练自己的数据集

Windows版YOLOv4目标检测实战:训练自己的数据集

HoloLens2开发入门教程

HoloLens2开发入门教程

微信小程序开发实战

微信小程序开发实战

Java8零基础入门视频教程

Java8零基础入门视频教程

相关热词 c# 按行txt c#怎么扫条形码 c#打包html c# 实现刷新数据 c# 两个自定义控件重叠 c#浮点类型计算 c#.net 中文乱码 c# 时间排序 c# 必备书籍 c#异步网络通信
立即提问