how to publish django website

Alibabacloud.com offers a wide variety of articles about how to publish django website, easily find your how to publish django website information here online.

"1" according to the Django website, write a web App

1. Creating a projectFrom the command line, CD -to-a directory where you ' d like to store your code and then run the following command:$ django-admin Startproject MySite let ' s look at whatstartproject created: mysite/manage.py mysite/__init__.py settings.py urls.py wsgi.py2. Installing Mysqlclient Pip Install Mysqlclient PS:MYSQLDB cannot be used for Python33.Database Setup? (MySQL)Now , open up mysite/settings.py. It's a normal Pyt

Website user identification Tips! Django Implementation cookie! You don't give full marks for this wave?

/models.py6. Complete the login logic functionviews.py7. Create a paging fileThe HTML file to use in the function. Create a new Templates folder under the online folder and save the following three HTML files.Login.htmlIndex.htmlRegist.html8. Create a data tableCreate a table of databases based on the user class created in file models.Python manage.py Makemigrationspython manage.py MigrateThe final file directory9. Open Service2. There is a "show cookie" button in privacy and security, which sto

News website Project django--some necessary configuration

uploaded fileStaticfiles_dirs= (Os.path.join ('Static'),)#absolute path to static filesadmin.py: from Import Admin from Import *# Register your models here. Remember to add the model you want to manage in the background admin.site.register (article) Admin.site.register (Category) admin.site.register (best) Admin.site.register (userprofile) Admin.site.register ( Comment)urls.py: from Import Static from Import Settings if settings. DEBUG: + = static (settings. Static_url, document_root=sett

Django-website Program Case Series -1 CSRF

Django provides users with the ability to prevent cross-site request forgeryYou need to configure settings.py:Django.middleware.csrf.CsrfViewMiddleware1. Form form submission  2. Ajax Way to submitJS uses Ajax to submit data, adding Csrf  Django-website Program Case Series -1 CSRF

News website Project django--registration page

mailbox format") If Len (password) Template CSS Register.css: Body{Background-image:url (.. /images/login/backgroundimg.png); Background-size:cover; Background-repeat:no-repeat;}. ui.basic.segment.container.content{width:425px; margin-left:50%; margin-top:389px;}. ui.header{color:red; font-size:50px!important; height:75px;} input{border-radius:31.5px!important; Height:31px!important; Background-color: #ffffff!important; Border:solid 1px #ededed!important;}. field{position:r

Django-website Program Case Series-8 page

Pagination Example Program:Paging functions:List = [] #全局列表for i in range: #1:100 of List.append (i) def user_list (request): Current_page = Request. Get.get (' P ', 1) # Get Received is the string current_page = Int (current_page) #字符串转换成数字    Per_page_count = Ten #每页显示多少条数据 start = (current_page-1) * per_page_count #页数显示数据开始 end = Current_page * Per_page_count #页数显示数据接收 data = list[start:end] #生成显示列表的索引 all_count = Len (LIST) #判断列表总长度 count, y = Divmod (

Django-website Program Case Series-5 modal dialogs for submitting data

HTML code:views.pyDEF host (Request): if Request.method = = "GET": #页面加载时的GET请求 v1 = models. Host.objects.filter (id__gt=0) b_list = models. Business.objects.all () return render (Request, ' host.html ', {' V1 ': v1, ' b_list ': b_list}) Elif Request.method = = "POST": h = Request. Post.get (' hostname ') i = Request. Post.get (' IP ') p = Request. Post.get (' Port ') B = Request. Post.get (' b_id ') # models. Host.objects.creat

Total Pages: 4 1 2 3 4 Go to: Go

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.