Django Simple implementation of project and app creation, and through the Admin management interface management

Source: Internet
Author: User

First, the admin management interface to achieve access

1. Create a project first

[Email protected]:~/django-1.5.12/django/bin# django-admin.py startproject Justplay

[Email protected]:~/django-1.5.12/django/bin/justplay# ls

Just Justplay manage.py


2. Create an App

[Email protected]:~/django-1.5.12/django/bin/jumptoquestion#./manage.py Startapp Play

[Email protected]:~/django-1.5.12/django/bin/justplay# ls

Just Justplay manage.py


3. Configure the settings.py file, change the database, and related content

[Email protected]:~/django-1.5.12/django/bin/justplay# VI justplay/settings.py

Configuration database

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/75/BF/wKioL1ZBuHaT_a9ZAAAsuYohvm0243.png "style=" float: none; "title=" Qq20151110172444.png "alt=" Wkiol1zbuhat_a9zaaasuyohvm0243.png "/>

Select the admin package and add the just app you created

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/75/BF/wKioL1ZBuHaA0AfMAAAu2qetthk828.png "style=" float: none; "title=" Qq20151110172540.png "alt=" Wkiol1zbuhaa0afmaaau2qetthk828.png "/>


Configuring URL Mappings

[Email protected]:~/django-1.5.12/django/bin/justplay# VI justplay/urls.py

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/75/C1/wKiom1ZBuXTz28_5AAA-MzS1mBg975.png "title=" Qq20151110173047.png "alt=" Wkiom1zbuxtz28_5aaa-mzs1mbg975.png "/>


4. Create a Database

Mysql> CREATE database play;

Mysql> grant all privileges on play.*-play identified by ' play ';


5. Synchronizing the database

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/75/C1/wKiom1ZBumDyyg7_AABJFYDNSMc184.png "title=" Qq20151110173517.png "alt=" Wkiom1zbumdyyg7_aabjfydnsmc184.png "/>


6. Start the access (the host with the same network segment with the port number can be accessed)

[Email protected]:~/django-1.5.12/django/bin/justplay#./manage.py Runserver 0.0.0.:8004

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/75/C1/wKiom1ZBuyeSfJVyAABEB1cyqEs834.png "title=" Qq20151110173830.png "alt=" Wkiom1zbuyesfjvyaabeb1cyqes834.png "/>


Second, the Just app content through admin management interface management

    1. Create a data table

[Email protected]:~/django-1.5.12/django/bin/justplay# VI just/models.py


Return returned content will be displayed in Admin admin interface

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/75/C0/wKioL1ZBwZSB41H5AAAv_OHsGfA766.png "title=" Qq20151110180437.png "alt=" Wkiol1zbwzsb41h5aaav_ohsgfa766.png "/>

2. Create a admin.py file to register the data sheet in the Admin management interface

[Email protected]:~/django-1.5.12/django/bin/justplay# VI just/admin.py

From Django.contrib Import admin

From just.models Import Book

Admin.site.register (book)


3. Synchronizing the database

[Email protected]:~/django-1.5.12/django/bin/justplay#./manage.py syncdb

4. Access IP in the browser: Port/admin

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/75/BF/wKioL1ZBv3CD_AxoAABOxeXnP7c448.png "title=" Qq20151110175522.png "alt=" Wkiol1zbv3cd_axoaaboxexnp7c448.png "/>








Django Simple implementation of project and app creation, and through the Admin management interface management

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.