0x00 django -- creating your first django project
1.preparatory work
python3: we will use python 3.5 to develop this project
pycharm: install pycharm professional on your computer--->Pycharm downloads
linux: we will develop this project on linux
django: pip3 install django
2.use pycharm IDLE to start your project
open your pycharm and create a django project
you will get a project
3.modify the setting file ~/djangoCarl/settings.py
ALLOWED_HOSTS = [ "127.0.0.1", "www.exampleCarlBenjamin.com" ]
4.create the index.html ~/templates/index.html like that
Hello Django Hello Django
5.modify your views ~/application/views.py like that
# coding=utf-8 from django.shortcuts import render # Create your views here. def application(request): return render(request, "index.html")
6.modify your urls ~/djangoCarl/urls.py like that
from django.conf.urls import url from django.contrib import admin from application.views import application urlpatterns = [ url(r"$", application, name="application"), url(r"^admin/", admin.site.urls), ]
7.cd to your workspace and
python3 manage.py runserver
8.You will see 127.0.0.1:8000
9.Now you complete your first project of django
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請注明本文地址:http://m.specialneedsforspecialkids.com/yun/38616.html
摘要:這篇教程從教程,我們會配置自己的數(shù)據(jù)庫,創(chuàng)造你的第一個(gè)模型,開始一個(gè)快捷的自動(dòng)生成管理員站點(diǎn)。項(xiàng)目是一個(gè)特性網(wǎng)站的相關(guān)配置和應(yīng)用的集合。 Writing your first django app, part 2 this tutorial begins where Tutorial 1 left off.Well setup the database, create your fir...
摘要:上一節(jié)項(xiàng)目框架已經(jīng)搭建完畢,現(xiàn)在開始連接數(shù)據(jù)庫,創(chuàng)建數(shù)據(jù)庫設(shè)置默認(rèn)安裝了數(shù)據(jù)庫打開文件數(shù)據(jù)庫引擎數(shù)據(jù)庫的名字小貼士如果你選擇,數(shù)據(jù)庫是以文件的形式生成,要設(shè)置成絕對路徑創(chuàng)建表結(jié)構(gòu)創(chuàng)建模型激活模型執(zhí)行命令執(zhí)行成功后目錄結(jié)構(gòu)如下圖 上一節(jié)項(xiàng)目框架已經(jīng)搭建完畢,現(xiàn)在開始連接數(shù)據(jù)庫,創(chuàng)建model 1、數(shù)據(jù)庫設(shè)置python默認(rèn)安裝了sqlite數(shù)據(jù)庫 打開文件:dayang/settings...
閱讀 1609·2021-11-02 14:48
閱讀 3664·2019-08-30 15:56
閱讀 2777·2019-08-30 15:53
閱讀 3220·2019-08-30 14:09
閱讀 3111·2019-08-30 12:59
閱讀 2866·2019-08-29 18:38
閱讀 2704·2019-08-26 11:41
閱讀 2224·2019-08-23 16:45