This article shares with you the main isDjangoTo enable the management site related content, come together to see it, I hope to everyoneLearningDjango has helped. Lab Environment: Win10operating system,Python2.7,Django1.10.3,MariaDB Windows Database driver: mysql-python-1.2.3.win32-py2.7.exeor mysql-python-1.2.3.win-amd64-py2.7.exe To Create a project:Open the command line, switch to the experiment directory, create the projectDj_admin 1.win+R,inputcmd,Enter, start command line 2.into the experiment directory, my directory is:"E:\PROJECTS\TEST” 3.django-admin.pyStartproject Dj_adminCreate a projectcurrent directory isThe structure is: Dj_admin |--Dj_admin | |--__init__.py | |--settings.py | |--urls.py | |--wsgi.py |--manage.py Catalogue Description: Dj_admin:the container for the project. manage.py:a practical command-line tool that allows you to work in various ways with theDjangoproject to interact. dj_admin/__init__.py:an empty file that tellsPythonThe directory is aPythonpackage. dj_admin/settings.py:theDjangosettings for the project/configuration. dj_admin/urls.py:theDjangoof the projectURLStatement; a copy byDjangoWeb-driven website"Catalogue". dj_admin/wsgi.py:aWSGIcompatible withWebthe portal of the server in order to run your project. To Configure the administration site: DjangoThe Automatic management tool isDjango.contribcan be part of a project'ssettings.pyin theInstalled_appsSee, the Management module is introduced by default: Installed_apps= [ ' Django.contrib.admin ', ' Django.contrib.auth ', ' Django.contrib.contenttypes ', ' Django.contrib.sessions ', ' Django.contrib.messages ', ' Django.contrib.staticfiles ', ] DjangoThe default database isSQLite, we seesettings.pyin theDATABASESThe configuration information is: DATABASES = { ' Default ': { ' ENGINE ': ' Django.db.backends.sqlite3 ', ' NAME ': Os.path.join (Base_dir, ' db.sqlite3 '), } }We change the configuration information for the database toMariaDB: DATABASES = { ' Default ': { ' ENGINE ': ' Django.db.backends.mysql ', ' NAME ': ' Dj_admin ', ' USER ': ' * * * ', ' PASSWORD ': ' * * * ', ' HOST ': ' *.*.*.* ', ' PORT ': 3306 } } to compile the project, migrate the data:1.go to the project root directorydj_admin/under, that isManage.pydirectory where the files are located2.pythonManage.pyMakemigrations #To generate a migration data file3.pythonManage.pyMigrate #Migrating Data4.pythonManage.pyCreatesuperuser #Create Administrator Information Username:d jadmin email address [email protected]com Password:1234qwer Start Project5.Start the servicepythonManage. pyRunserver0.0.0.0:8000 #IPset to0.0.0.0that allows anyIPAccess6.access the service and log inhttp://localhost:8000/admin/ username:d Jadmin Password: 1234qwer
Login. png
User List. PNG Source:Jane Book
Django Learning to enable management site detailed