[英]Why does django continues naming my app as the previous name?
thanks for reading.谢谢阅读。
When I run "py manage.py makemigrations" I get the following message: "ModuleNotFoundError: No module named 'transformaTe'"当我运行“py manage.py makemigrations”时,我收到以下消息:“ModuleNotFoundError: No module named 'transformaTe'”
This is the apps.py code:这是 apps.py 代码:
from django.apps import AppConfig
class TransformateConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'transformate'
The name is updated there and in my INSTALLED_APPS:名称在那里和我的 INSTALLED_APPS 中更新:
INSTALLED_APPS = [
'transformate',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
Where else should I look to change the name of the app?我还应该在哪里查看更改应用程序的名称?
This is the simplified structure of the app:这是应用程序的简化结构:
\my-app
\transformate
admin.py
apps.py
models.py
urls.py
views.py
\my-app
asgi.py
settigs.py
urls.py
wsgi.py
All this happened when I rename the app because I had a problem creating a table called transformaTe_myuser so I though all could be caused by the capitalized letter use.所有这一切都发生在我重命名应用程序时,因为我在创建一个名为 transformaTe_myuser 的表时遇到了问题,所以我认为这一切都可能是由大写字母的使用引起的。
Is there a better way of renaming an existing app in Django?在 Django 中重命名现有应用程序是否有更好的方法? I followed this steps, except for the migration part (Because I deleted the db and the migrations folder): https://odwyer.software/blog/how-to-rename-an-existing-django-application
我按照以下步骤操作,除了迁移部分(因为我删除了数据库和迁移文件夹): https://odwyer.software/blog/how-to-rename-an-existing-django-application
Thanks for your help.谢谢你的帮助。
Well, it turns out that when you run makemigrations you have to check the project urls.py file, that was the only thing that was crashing my migrations.好吧,事实证明,当您运行 makemigrations 时,您必须检查项目 urls.py 文件,这是唯一导致我的迁移崩溃的事情。
ORIGINAL my-app/urls.原始我的应用程序/网址。 py FILE:
文件:
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('', include('transformaTe.urls')),
path('admin/', admin.site.urls),
]
NEEDED FILE:需要的文件:
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('', include('transformate.urls')), # Here was the bug
path('admin/', admin.site.urls),
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.