django1.5官方入门教程第1部分

django1.5官方入门教程第1部分

ID:34722675

大小:259.18 KB

页数:28页

时间:2019-03-10

django1.5官方入门教程第1部分_第1页
django1.5官方入门教程第1部分_第2页
django1.5官方入门教程第1部分_第3页
django1.5官方入门教程第1部分_第4页
django1.5官方入门教程第1部分_第5页
资源描述:

《django1.5官方入门教程第1部分》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、第一个Djangoapp,第1部分让我们从例子开始学习.Throughoutthistutorial,we’llwalkyouthroughthecreationofabasicpollapplication.通过整个教程,我们会从头至尾向你介绍怎样创建一个基本的投票程序。。It’llconsistoftwoparts:这个应用程序这将包括两部分:§Apublicsitethatletspeopleviewpollsandvoteinthem.一个能够让用户查看投票选项并进行投票的前台§Anadminsitethatlets

2、youadd,changeanddeletepolls.一个能够进行投票管理的后台We’llassumeyouhave Djangoinstalled already.YoucantellDjangoisinstalledandwhichversionbyrunningthefollowingcommand: 我们假设你已经安装了Django。通过下面的命令,你可以得到Django的版本。(译者注:Windows操作系统,首先将python的安装路径添加到系统路径中,然后在cmd中运行这个命令。)python-c"impor

3、tdjango;print(django.get_version())"YoushouldseeeithertheversionofyourDjangoinstallationoranerrortelling“Nomodulenameddjango”.Checkalsothattheversionnumbermatchestheversionofthistutorial.Iftheydon’tmatch,youcanrefertothetutorialforyourversionofDjangoorupdateDjangot

4、othenewestversion. 你应该看Django版本号,或者是一条错误信息“django模块没有定义”。请确定你的版本号与本教程的一致。如果不一致,查看相应版本的教程,或把Django更新到本版本。See HowtoinstallDjango foradviceonhowtoremoveolderversionsofDjangoandinstallanewerone. 请参阅如何卸载和安装Django。Wheretogethelp:Ifyou’rehavingtroublegoingthroughthistutor

5、ial,pleasepostamessageto django-users ordropby #djangoonirc.freenode.net tochatwithotherDjangouserswhomightbeabletohelp.Creatingaproject创建项目IfthisisyourfirsttimeusingDjango,you’llhavetotakecareofsomeinitialsetup.Namely,you’llneedtoauto-generatesomecodethatestablish

6、esaDjango project –acollectionofsettingsforaninstanceofDjango,includingdatabaseconfiguration,Django-specificoptionsandapplication-specificsettings. 如果这是你第一次使用Django,你需要注意一下初始化设置。也就是说,你需要自动创建一些Django项目初始化的代码——包括数据库设置、Django特性设置以及程序特性设置。Fromthecommandline, cd intoadi

7、rectorywhereyou’dliketostoreyourcode,thenrunthefollowingcommand: 在命令行界面下,进入到你放置代码的目录中,执行命令django-admin.pystartprojectmysite。django-admin.pystartprojectmysiteThiswillcreatea mysite directoryinyourcurrentdirectory.Ifitdidn’twork,see Problemsrunningdjango-admin.py. 这将

8、在当前目录下创建一个mysite目录,如果失败,请查看有关运行django-admin.py的内容。NoteYou’llneedtoavoidnamingprojectsafterbuilt-inPythonorDjangocomponents.Inparticular,thismeans

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。