In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what is the role of django admin and manage.py". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the functions of django admin and manage.py"?
Opening remarks:
In our Django development process, the most command line execution should be python manage.py. Let's talk about the command manage.py today.
Main points of record:
Django-admin and manage.py can do the same thing.
Like our commonly used python manage.py runserver, you can also operate with django-admin: django-admim runserver
Note:
Django-admin needs to configure the DJANGO_SETTINGS_MODULE environment variable in advance, or specify settings:django-admin runserver-- settings=mysite.settings when executing.
Manage.py is recommended because it is easier to use and does not need to be configured.
Diffsettings
Lists the changes between the current settings.py content and the default created settings.py, followed by "#" after the settings that do not appear in the default settings.
Fulsh
Under Linux, we often tease, if you can't solve the problem, then try: rm-rf / (joke, please don't practice)
Django also has a type of command: python manage.py flush, which deletes default databases by default. If multiple databases are configured in setting.py, you can specify: python manage.py flush-- database DATABASE
Showmigrations
Showmigrations [app_label [app_label...]] Displays all migrations in the project.
If you have a database, you can add the parameter:-- database DATABASE
The output effect is as follows:
Admin
[X] 0001_initial
[X] 0002_logentry_remove_auto_add
[] 0003_logentry_add_action_flag_choices
Startapp
Generally, we create an app that works like this: python manage.py startapp appname.
If app2, 3 times, we can do this directly. But knowing that there will be a lot of app under our project, we can create a python package in the project directory in advance, and then directly specify the path: python manage.py startapp appname [filepath] to avoid moving later.
Test
Common command: python manage.py test
If we want to keep the test data, we can take the parameter-- keepdb,-k, so that the test data will be retained.
There will be an article on test at a later stage, please look forward to it.
Collectstatic
This command is needed when the style of the admin management background of django is set to True, which results in the loss of page style when DEBUG is set to.
At this point, I believe you have a deeper understanding of "what is the role of django admin and manage.py". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.