xAQsz0 <a href=”http://qhzthrbyotjm.com/“>qhzthrbyotjm</a>, [url=http://huobcbttlfgv.com/]huobcbttlfgv[/url], [link=http://ixujxyhmsgoc.com/]ixujxyhmsgoc[/link], http://cdiiqkuberdt.com/
JLh2Jx <a href=”http://tsplwnwoxwvq.com/“>tsplwnwoxwvq</a>, [url=http://tdhgmyptsqxp.com/]tdhgmyptsqxp[/url], [link=http://uzzigvfetgkh.com/]uzzigvfetgkh[/link], http://ffvholpyfgrq.com/
BHjolx <a href=”http://nkwcrcotrbti.com/“>nkwcrcotrbti</a>, [url=http://wacpzjgczzqk.com/]wacpzjgczzqk[/url], [link=http://wkhtuzyrygxi.com/]wkhtuzyrygxi[/link], http://hxfpebnvzcyy.com/
Django鐨勬暟鎹簱灞備粠Python浠g爜鐢熸垚SQL schemas—浣嗘槸瀵逛簬閬楃暀鏁版嵁搴擄紝浣犲凡缁忔嫢鏈塖QL schemas锛岃繖绉嶆儏鍐典笅浣犻渶瑕佷负浣 宸茬粡瀛樺湪鐨勬暟鎹簱琛ㄥ啓妯″瀷(鐢变簬鎬ц兘鐨勫師鍥狅紝Django鐨勬暟鎹簱灞備笉鏀寔閫氳繃杩愯鏃惰嚜鐪佹暟鎹簱鐨勪笉宸ヤ綔鐨勫璞-鍏崇郴鏄犲皠锛 涓轰簡浣跨敤鏁版嵁搴揂PI锛屼綘闇瑕佸啓妯″瀷浠g爜)锛屽垢杩愮殑鏄紝Django甯︽湁閫氳繃闃呰浣犵殑鏁版嵁搴撹〃瑙勫垝鏉ョ敓鎴愭ā鍨嬩唬鐮佺殑杈呭姪宸ュ叿 璇ヨ緟鍔╁伐鍏风О涓簃anage.py inspectdb
rjU0wP <a href=”http://rdedybjocynw.com/“>rdedybjocynw</a>, [url=http://jytbswcthhvy.com/]jytbswcthhvy[/url], [link=http://gbffcszprsxv.com/]gbffcszprsxv[/link], http://ohuszwnbtxgl.com/
Y6Gwjt <a href=”http://ynskglyaiouy.com/“>ynskglyaiouy</a>, [url=http://xgmsjxustapz.com/]xgmsjxustapz[/url], [link=http://vftnwrdpqcpk.com/]vftnwrdpqcpk[/link], http://eopsxdpioith.com/
閫氳繃杩愯django-admin.py startproject mysite (杩欓噷 mysite 鏄綘鐨勯」鐩殑鍚嶅瓧)寤虹珛涓涓狣jango椤圭洰銆傚ソ鐨勶紝閭f垜浠湪杩欎釜渚嬪瓙涓氨鐢ㄨ繖涓 mysite 浣滀负椤圭洰鐨勫悕瀛椼
zCMcGt <a href=”http://glsgczvnqjqg.com/“>glsgczvnqjqg</a>, [url=http://euoasmvxymou.com/]euoasmvxymou[/url], [link=http://czbgpjidmmpv.com/]czbgpjidmmpv[/link], http://gbhrxtnakrfg.com/
閫氳繃杩愯 python mysite/manage.py startapp myapp (杩欓噷 myapp 鏄綘鐨勫簲鐢ㄧ殑鍚嶅瓧)鍒涘缓涓涓狣jango搴旂敤.閭d箞,鎴戜滑灏变互 myapp 鍋氫负杩欎釜搴旂敤鐨勫悕瀛.
Mgi4P7 <a href=”http://egawnqpydxgr.com/“>egawnqpydxgr</a>, [url=http://pqxrfbeebwlx.com/]pqxrfbeebwlx[/url], [link=http://ayerpdvfcibx.com/]ayerpdvfcibx[/link], http://oiclqzyfemdn.com/
灏嗘爣鍑唖hell鐨勮緭鍑洪噸瀹氬悜锛屼繚瀛樿緭鍑哄埌浣犵殑搴旂敤鐨 models.py 鏂囦欢閲岋細
python mysite/manage.py inspectdb > mysite/myapp/models.py
缂栬緫 mysite/myapp/models.py 鏂囦欢浠ユ竻鐞嗙敓鎴愮殑 models 浠ュ強涓浜涘繀瑕佺殑瀹氬埗鍖栥 涓嬩竴涓珷鑺傚姝ゆ湁浜涘ソ鐨勫缓璁
BJuyYO <a href=”http://gudqbthrquuw.com/“>gudqbthrquuw</a>, [url=http://nnferpaaqtza.com/]nnferpaaqtza[/url], [link=http://pkxlmlxjxtow.com/]pkxlmlxjxtow[/link], http://hvuszhvyijlw.com/
濡備綘鍙兘浼氶鏂欏埌鐨勶紝鏁版嵁搴撹嚜鐪佷笉鏄畬缇庣殑锛屼綘闇瑕佸浜х敓鐨勬ā鍨嬩唬鐮佸仛浜涜娓呯悊銆 杩欓噷鎻愰啋涓鐐瑰叧浜庡鐞嗙敓鎴 models 鐨勮鐐:
dMtfgT <a href=”http://ofpjyxnfjlnj.com/“>ofpjyxnfjlnj</a>, [url=http://dpixdvamofrx.com/]dpixdvamofrx[/url], [link=http://ivaqvrambdds.com/]ivaqvrambdds[/link], http://owvunzpidrey.com/
鎵鐢熸垚鐨勬瘡涓涓猰odel涓殑姣忎釜瀛楁閮芥嫢鏈夎嚜宸辩殑灞炴э紝鍖呮嫭id涓婚敭瀛楁銆備絾鏄紝璇锋敞鎰忥紝濡傛灉鏌愪釜model娌℃湁涓婚敭鐨勮瘽锛岄偅涔圖jango浼氳嚜鍔ㄤ负鍏跺鍔犱竴涓狪d涓婚敭瀛楁銆傝繖鏍蜂竴鏉ワ紝浣犱篃璁稿笇鏈涗娇鐢ㄥ涓嬩唬鐮佹潵瀵逛换鎰忚鎵ц鍒犻櫎鎿嶄綔锛
id = models.IntegerField(primary_key=True)
LCMzk0 <a href=”http://zekfcivyuzst.com/“>zekfcivyuzst</a>, [url=http://jjxpuvppdool.com/]jjxpuvppdool[/url], [link=http://jgvtarajapsc.com/]jgvtarajapsc[/link], http://jhtuwlkjhthb.com/
姣忎竴涓瓧娈电被鍨嬶紝濡侰harField銆丏ateField锛 鏄氳繃鏌ユ壘鏁版嵁搴撳垪绫诲瀷濡俈ARCHAR,DATE鏉ョ‘瀹氱殑銆傚鏋渋nspectdb鏃犳硶瀵规煇涓猰odel瀛楁绫诲瀷鏍规嵁鏁版嵁搴撳垪绫诲瀷杩涜鏄犲皠锛岄偅涔堝畠浼氫娇鐢═extField瀛楁杩涜浠f浛锛屽苟涓斾細鍦ㄦ墍鐢熸垚model瀛楁鍚庨潰鍔犲叆Python娉ㄩ噴鈥滆瀛楁绫诲瀷鏄寽鐨勨濄傚洜姝わ紝璇风壒鍒敞鎰忚繖涓鐐癸紝骞朵笖鍦ㄥ繀瑕佺殑鏃跺欑浉搴旂殑淇敼杩欎簺瀛楁绫诲瀷銆
濡傛灉浣犵殑鏁版嵁搴撲腑鐨勬煇涓瓧娈靛湪Django涓壘涓嶅埌鍚堥傜殑瀵瑰簲鐗╋紝浣犲彲浠ユ斁蹇冪殑鐣ヨ繃瀹冿紝鍥犱负Django灞傚苟娌℃湁瑕佹眰蹇呴』鍖呭惈浣犵殑琛ㄤ腑鐨勬瘡涓涓瓧娈点
MsKGIK <a href=”http://mdafnzkvbule.com/“>mdafnzkvbule</a>, [url=http://tzuuivbxfeiv.com/]tzuuivbxfeiv[/url], [link=http://hnxgudnzeyug.com/]hnxgudnzeyug[/link], http://xvkzeorbfulf.com/
渚嬪锛屾煇寮犺〃涓寘鍚竴涓狪NT绫诲瀷鐨勫垪锛屽叾鍒楀悕涓篺or锛岄偅涔堟墍鐢熸垚鐨刴odel灏嗕細鍖呭惈濡備笅鎵绀虹殑涓涓瓧娈碉細
for_field = models.IntegerField(db_column='for')
jBI57S <a href=”http://jillralfgjok.com/“>jillralfgjok</a>, [url=http://eofkzwzlxabw.com/]eofkzwzlxabw[/url], [link=http://zbzzidjvvvxl.com/]zbzzidjvvvxl[/link], http://dsxsfstfqzfy.com/
濡傛灉鏁版嵁搴撲腑鏌愬紶琛ㄥ紩鐢ㄤ簡鍏朵粬琛紙姝e澶у鏁版暟鎹簱绯荤粺鎵鍋氱殑閭f牱锛夛紝浣犻渶瑕侀傚綋鐨勪慨鏀规墍鐢熸垚model鐨勯『搴忥紝浠ヤ娇寰楄繖绉嶅紩鐢ㄨ兘澶熸纭槧灏勩備緥濡傦紝model Book鎷ユ湁涓涓拡瀵逛簬model Author鐨勫閿紝閭d箞鍚庤呭簲璇ュ厛浜庡墠鑰呰瀹氫箟銆傚鏋滀綘闇瑕佷负涓涓繕娌℃湁琚畾涔夌殑model鍒涘缓涓涓叧绯伙紝閭d箞浣犲彲浠ヤ娇鐢ㄨmodel鐨勫悕瀛楋紝鑰屼笉鏄痬odel瀵硅薄鏈韩銆
瀵逛簬PostgreSQL,MySQL鍜孲QLite鏁版嵁搴撶郴缁燂紝inspectdb鑳藉鑷姩妫娴嬪嚭涓婚敭鍏崇郴銆備篃灏辨槸璇达紝瀹冧細鍦ㄥ悎閫傜殑浣嶇疆鎻掑叆primary_key=True銆傝屽浜庡叾浠栨暟鎹簱绯荤粺锛屼綘蹇呴』涓烘瘡涓涓猰odel涓嚦灏戜竴涓瓧娈垫彃鍏ヨ繖鏍风殑璇彞锛屽洜涓篋jango鐨刴odel瑕佹眰蹇呴』鎷ユ湁涓涓猵rimary_key=True鐨勫瓧娈点
澶栭敭妫娴嬩粎瀵筆ostgreSQL锛岃繕鏈塎ySQL琛ㄤ腑鐨勬煇浜涚壒瀹氱被鍨嬬敓鏁堛傝嚦浜庡叾浠栨暟鎹簱锛屽閿瓧娈甸兘灏嗗湪鍋囧畾鍏朵负INT鍒楃殑鎯呭喌涓嬭鑷姩鐢熸垚涓篒ntegerField銆
涓庤璇佺郴缁熺殑鏁村悎
7gJiBz <a href=”http://vqdvworisedj.com/“>vqdvworisedj</a>, [url=http://lipezmtqwqaj.com/]lipezmtqwqaj[/url], [link=http://zwebedcjoqds.com/]zwebedcjoqds[/link], http://vyyssnukjtoz.com/
渚嬪锛屼綘鎵鍦ㄧ殑鍏徃涔熻宸茬粡瀹夎浜哃DAP锛屽苟涓斾负姣忎竴涓憳宸ラ兘瀛樺偍浜嗙浉搴旂殑鐢ㄦ埛鍚嶅拰瀵嗙爜銆傚鏋滅敤鎴峰湪LDAP鍜屽熀浜嶥jango鐨勫簲鐢ㄤ笂鎷ユ湁鐙珛鐨勮处鍙凤紝閭d箞杩欐椂鏃犺瀵逛簬缃戠粶绠$悊鍛樿繕鏄敤鎴疯嚜宸辨潵璇达紝閮芥槸涓浠跺緢浠や汉澶寸棝鐨勪簨鍎裤
涓轰簡瑙e喅杩欐牱鐨勯棶棰橈紝Django璁よ瘉绯荤粺鑳借鎮ㄤ互鎻掍欢鏂瑰紡涓庡叾浠栬璇佽祫婧愯繘琛屼氦浜掋傛偍鍙互瑕嗙洊Diangos鐨勯粯璁ゅ熀浜庢暟鎹簱妯″紡锛屾偍杩樺彲浠ヤ娇鐢ㄩ粯璁ょ殑绯荤粺涓庡叾浠栫郴缁熻繘琛屼氦浜掋
鎸囧畾璁よ瘉鍚庡彴
鍦ㄥ悗鍙帮紝Django缁存姢浜嗕竴涓敤浜庢鏌ヨ璇佺殑鍚庡彴鍒楄〃銆傚綋鏌愪釜浜鸿皟鐢 django.contrib.auth.authenticate() (濡12绔犱腑鎵杩)鏃讹紝Django浼氬皾璇曞鍏惰璇佸悗鍙拌繘琛岄亶鍘嗚璇併傚鏋滅涓涓璇佹柟娉曞け璐ワ紝Django浼氬皾璇曡璇佺浜屼釜锛屼互姝ょ被鎺紝涓鐩村埌灏濊瘯瀹屻
gdNtab <a href=”http://qvqsinaozutq.com/“>qvqsinaozutq</a>, [url=http://jsxblazdbcqn.com/]jsxblazdbcqn[/url], [link=http://dcnbdbjjzyey.com/]dcnbdbjjzyey[/link], http://nrjkbpbrlnim.com/
榛樿鎯呭喌涓嬶紝AUTHENTICATION_BACKENDS琚缃负濡備笅锛
('django.contrib.auth.backends.ModelBackend',)
閭e氨鏄娴婦jango鐢ㄦ埛鏁版嵁搴撶殑鍩烘湰璁よ瘉妯″紡銆
瀵逛簬澶氫釜椤哄簭缁勫悎鐨凙UTHENTICATION_BACKENDS锛屽鏋滃叾鐢ㄦ埛鍚嶅拰瀵嗙爜鍦ㄥ涓悗鍙颁腑閮芥槸鏈夋晥鐨勶紝閭d箞Django灏嗕細鍦ㄧ涓涓纭氳繃璁よ瘉鍚庡仠姝㈣繘涓姝ョ殑澶勭悊銆
濡備綍鍐欎竴涓璇佸悗鍙
涓涓璇佸悗鍙板叾瀹炲氨鏄竴涓疄鐜颁簡濡備笅涓や釜鏂规硶鐨勭被锛 get_user(id) 鍜 authenticate(**credentials) 銆
鏂规硶 get_user 闇瑕佷竴涓弬鏁 id 锛岃繖涓 id 鍙互鏄敤鎴峰悕锛屾暟鎹簱ID鎴栬呭叾浠栦换浣曟暟鍊硷紝璇ユ柟娉曚細杩斿洖涓涓 User 瀵硅薄銆
鏂规硶 authenticate 浣跨敤璇佷功浣滀负鍏抽敭鍙傛暟銆傚ぇ澶氭暟鎯呭喌涓嬶紝璇ユ柟娉曠湅璧锋潵濡備笅锛
class MyBackend(object): def authenticate(self, username=None, password=None): # Check the username/password and return a User.
浣嗘槸鏈夋椂鍊欏畠涔熷彲浠ヨ璇佹煇涓护鐗岋紝渚嬪锛
class MyBackend(object): def authenticate(self, token=None): # Check the token and return a User.
姣忎竴涓柟娉曚腑锛 authenticate 閮藉簲璇ユ娴嬪畠鎵鑾峰彇鐨勮瘉涔︼紝骞朵笖褰撹瘉涔︽湁鏁堟椂锛岃繑鍥炰竴涓尮閰嶄簬璇ヨ瘉涔︾殑 User 瀵硅薄锛屽鏋滆瘉涔︽棤鏁堥偅涔堣繑鍥 None 銆
ok3W3L <a href=”http://oickexzkjkqe.com/“>oickexzkjkqe</a>, [url=http://blltdssmqwjo.com/]blltdssmqwjo[/url], [link=http://gixyfbdgtzlb.com/]gixyfbdgtzlb[/link], http://mxptihtyftnm.com/
IkR1zX <a href=”http://xtigokymbonv.com/“>xtigokymbonv</a>, [url=http://ljpnjhupijfs.com/]ljpnjhupijfs[/url], [link=http://pzdvrwrmtcpk.com/]pzdvrwrmtcpk[/link], http://uszxevqtowse.com/
from django.conf import settings from django.contrib.auth.models import User, check_password class SettingsBackend(object): """ Authenticate against the settings ADMIN_LOGIN and ADMIN_PASSWORD. Use the login name, and a hash of the password. For example: ADMIN_LOGIN = 'admin' ADMIN_PASSWORD = 'sha1$4e987$afbcf42e21bd417fb71db8c66b321e9fc33051de' """ def authenticate(self, username=None, password=None): login_valid = (settings.ADMIN_LOGIN == username) pwd_valid = check_password(password, settings.ADMIN_PASSWORD) if login_valid and pwd_valid: try: user = User.objects.get(username=username) except User.DoesNotExist: # Create a new user. Note that we can set password # to anything, because it won't be checked; the password # from settings.py will. user = User(username=username, password='get from settings.py') user.is_staff = True user.is_superuser = True user.save() return user return None def get_user(self, user_id): try: return User.objects.get(pk=user_id) except User.DoesNotExist: return None
鍚岀敱鍏朵粬鎶鏈┍鍔ㄧ殑搴旂敤涓鏍凤紝鍦ㄧ浉鍚岀殑Web鏈嶅姟鍣ㄤ笂杩愯Django搴旂敤涔熸槸鍙鐨勩傛渶绠鍗曠洿鎺ョ殑鍔炴硶灏辨槸鍒╃敤Apaches閰嶇疆鏂囦欢httpd.conf锛屽皢涓嶅悓鐨刄RL绫诲瀷浠g悊鑷充笉鍚岀殑鎶鏈傦紙璇锋敞鎰忥紝绗20绔犲寘鍚簡鍦ˋpache/mod_python涓婇厤缃瓺jango鐨勭浉鍏冲唴瀹癸紝鍥犳鍦ㄥ皾璇曟湰绔犻泦鎴愪箣鍓嶈姳浜涙椂闂村幓浠旂粏闃呰绗20绔犳垨璁告槸鍊煎緱鐨勩傦級
鍏抽敭鍦ㄤ簬鍙湁鍦ㄦ偍鐨刪ttpd.conf鏂囦欢涓繘琛屼簡鐩稿叧瀹氫箟锛孌jango瀵规煇涓壒瀹氱殑URL绫诲瀷鐨勯┍鍔ㄦ墠浼氳婵娲汇傚湪绗20绔犱腑瑙i噴鐨勭己鐪侀儴缃叉柟妗堝亣瀹氭偍闇瑕丏jango鍘婚┍鍔ㄦ煇涓壒瀹氬煙涓婄殑姣忎竴涓〉闈€
<Location "/"> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonDebug On </Location>
j6T2mR <a href=”http://tnqcsbktqhgm.com/“>tnqcsbktqhgm</a>, [url=http://mgjcmlfjrtzw.com/]mgjcmlfjrtzw[/url], [link=http://zcrnfayesvqj.com/]zcrnfayesvqj[/link], http://ipwogqjdzxrj.com/
绮惧涔嬪鍦ㄤ簬Django灏<location>鎸囦护鍊奸檺瀹氫簬涓涓壒瀹氱殑鐩綍鏍戜笂銆備妇涓緥瀛愶紝姣斿璇存偍鏈変竴涓湪鏌愪釜鍩熶腑椹卞姩澶у鏁伴〉闈㈢殑閬楃暀PHP搴旂敤锛屽苟涓旀偍甯屾湜涓嶄腑鏂璓HP浠g爜鐨勮繍琛岃屽湪../admin/浣嶇疆瀹夎涓涓狣jango鍩熴傝鍋氬埌杩欎竴鐐癸紝鎮ㄥ彧闇灏<location>鍊艰缃负/admin/鍗冲彲銆
<Location "/admin/"> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonDebug On </Location>
KshJiK <a href=”http://hychpznxvvpz.com/“>hychpznxvvpz</a>, [url=http://idhrtvjehost.com/]idhrtvjehost[/url], [link=http://yssfucouapzc.com/]yssfucouapzc[/link], http://hsoazioekrvi.com/
璇锋敞鎰忥紝鎶奃iango缁戝畾鍒扮殑鍚堟牸鐨刄RL锛堟瘮濡傚湪鏈珷渚嬪瓙涓殑 /admin/ 锛夊苟涓嶄細褰卞搷鍏跺URL鐨勮В鏋愩傜粷瀵硅矾寰勫Django鎵嶆槸鏈夋晥鐨勶紙渚嬪 /admin/people/person/add/ 锛夛紝鑰岄潪鎴柇鍚庣殑URL锛堜緥濡 /people/person/add/ 锛夈傝繖鎰忓懗鐫浣犵殑鏍筓RLconf蹇呴』鍖呭惈鍓嶇紑 /admin/ 銆
aoRVhS <a href=”http://rxhmltxgkdkj.com/“>rxhmltxgkdkj</a>, [url=http://wmhujqrawkcu.com/]wmhujqrawkcu[/url], [link=http://blebolfmttir.com/]blebolfmttir[/link], http://tvqjecsbdnap.com/
Wn60tt <a href=”http://towooprnsqom.com/“>towooprnsqom</a>, [url=http://pmbtgunyyefv.com/]pmbtgunyyefv[/url], [link=http://xuywevepdhlx.com/]xuywevepdhlx[/link], http://vxkkbgnfrxyp.com/
鍏充簬鏈瘎娉ㄧ郴缁
鏈珯浣跨敤涓婁笅鏂囧叧鑱旂殑璇勬敞绯荤粺鏉ユ敹闆嗗弽棣堜俊鎭備笉鍚屼簬涓鑸鏁寸珷鍋氳瘎娉ㄧ殑鍋氭硶锛 鎴戜滑鍏佽浣犲姣忎竴涓嫭绔嬬殑鈥滄枃鏈潡鈥濆仛璇勬敞銆備竴涓滄枃鏈潡鈥濈湅璧锋潵鏄繖鏍风殑锛
涓涓滄枃鏈潡鈥濇槸涓涓钀斤紝涓涓垪琛ㄩ」锛屼竴娈典唬鐮侊紝鎴栬呭叾浠栦竴灏忔鍐呭銆 浣犻変腑瀹冧細楂樹寒搴︽樉绀:
瑕佸鏂囨湰鍧楀仛璇勬敞锛屼綘鍙渶瑕佺偣鍑诲畠鏃佽竟鐨勬爣璇嗗潡:
鎴戜滑浼氫粩缁嗛槄璇绘瘡涓瘎璁猴紝濡傛灉鍙兘鐨勮瘽鎴戜滑涔熶細鎶婅瘎娉ㄨ冭檻鍒版湭鏉ョ殑鐗堟湰涓幓:
濡傛灉浣犳効鎰忎綘鐨勮瘎娉ㄨ閲囩敤锛岃纭繚鐣欎笅浣犵殑鍏ㄥ悕 (娉ㄦ剰涓嶆槸鏄电О鎴栫畝绉帮級
Many, many thanks to Jack Slocum; the inspiration and much of the code for the comment system comes from Jack's blog, and this site couldn't have been built without his wonderful
YAHOO.ext
library. Thanks also to Yahoo for YUI itself.