-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path98ce8162.9fdaca80.js
1 lines (1 loc) · 8.27 KB
/
98ce8162.9fdaca80.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[26],{112:function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return j}));var r=n(0),a=n.n(r);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=a.a.createContext({}),b=function(e){var t=a.a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=b(e.components);return a.a.createElement(p.Provider,{value:t},e.children)},g={inlineCode:"code",wrapper:function(e){var t=e.children;return a.a.createElement(a.a.Fragment,{},t)}},u=a.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,c=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),s=b(n),u=r,j=s["".concat(c,".").concat(u)]||s[u]||g[u]||i;return n?a.a.createElement(j,l(l({ref:t},p),{},{components:n})):a.a.createElement(j,l({ref:t},p))}));function j(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,c=new Array(i);c[0]=u;var l={};for(var o in t)hasOwnProperty.call(t,o)&&(l[o]=t[o]);l.originalType=e,l.mdxType="string"==typeof e?e:r,c[1]=l;for(var p=2;p<i;p++)c[p]=n[p];return a.a.createElement.apply(null,c)}return a.a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},94:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return c})),n.d(t,"metadata",(function(){return l})),n.d(t,"rightToc",(function(){return o})),n.d(t,"default",(function(){return b}));var r=n(3),a=n(7),i=(n(0),n(112)),c={id:"start",title:"\u5feb\u901f\u5f00\u59cb"},l={unversionedId:"start",id:"start",isDocsHomePage:!1,title:"\u5feb\u901f\u5f00\u59cb",description:"\u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u9700\u8981\u5148\u5b66\u4e60 Python \u4e0e Django",source:"@site/docs/start.md",slug:"/start",permalink:"/lightning-doc/docs/start",editUrl:"https://gitee.com/gitmen/lightning-doc-src/blob/master/docs/start.md",version:"current",sidebar:"someSidebar",previous:{title:"lightning\u7b80\u4ecb",permalink:"/lightning-doc/docs/"},next:{title:"\u793a\u4f8b\u5e94\u7528\uff1aCRM -- \u5ba2\u6237\u5173\u7cfb\u7ba1\u7406",permalink:"/lightning-doc/docs/crm"}},o=[{value:"\u51c6\u5907",id:"\u51c6\u5907",children:[]},{value:"\u5b89\u88c5",id:"\u5b89\u88c5",children:[]},{value:"\u914d\u7f6e",id:"\u914d\u7f6e",children:[]},{value:"Migrate",id:"migrate",children:[]},{value:"\u751f\u6210\u7ba1\u7406\u754c\u9762",id:"\u751f\u6210\u7ba1\u7406\u754c\u9762",children:[]},{value:"\u8fd0\u884c",id:"\u8fd0\u884c",children:[]}],p={rightToc:o};function b(e){var t=e.components,n=Object(a.a)(e,["components"]);return Object(i.b)("wrapper",Object(r.a)({},p,n,{components:t,mdxType:"MDXLayout"}),Object(i.b)("p",null,"\u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u9700\u8981\u5148\u5b66\u4e60 ",Object(i.b)("a",Object(r.a)({parentName:"p"},{href:"https://www.python.org/"}),"Python")," \u4e0e ",Object(i.b)("a",Object(r.a)({parentName:"p"},{href:"https://www.djangoproject.com/"}),"Django")),Object(i.b)("h3",{id:"\u51c6\u5907"},"\u51c6\u5907"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("strong",{parentName:"li"},"Python")," \u6700\u4f4e\u9700\u8981 3.6 \u7248\u672c"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("strong",{parentName:"li"},"Django")," \u9700\u8981 2.2.x \u7248\u672c\uff0cDjango 3.x\u6682\u4e0d\u652f\u6301\u3002")),Object(i.b)("h3",{id:"\u5b89\u88c5"},"\u5b89\u88c5"),Object(i.b)("p",null,"\u65b9\u6cd5\u4e00\uff1a\u901a\u8fc7pip \u5b89\u88c5 lightning"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-sh"}),"pip install django-lightning\n")),Object(i.b)("p",null,"pipy\u4e0a\u7684\u7248\u672c\u4e3a\u7a33\u5b9a\u7248\uff0c\u66f4\u65b0\u9891\u7387\u504f\u4f4e\u3002\u66f4\u591a\u65b0\u7684\u529f\u80fd\u7279\u6027\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee3\u7801\u5b89\u88c5\uff0c\u4ecedevelop\u5206\u652f\u4e0a\u83b7\u5f97\uff1a"),Object(i.b)("p",null,"\u65b9\u6cd5\u4e8c\uff1a\u4ece\u4ee3\u7801\u5b89\u88c5\u5f00\u53d1\u7248 lightning"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-sh"}),"$ git clone https://gitee.com/gitmen/lightning.git\n$ cd lightning\n$ python setup.py install\n")),Object(i.b)("p",null,"\u6267\u884cpython setup.py install\u524d\uff0c\u5148\u68c0\u67e5\u4e00\u4e0b\u4ee3\u7801\u6240\u5904\u5206\u652f\u662f\u5426\u4e3adevelop\u3002\u5982\u679c\u4e0d\u662f\uff0c\u5efa\u8bae\u5207\u6362\u81f3develop\u3002"),Object(i.b)("h3",{id:"\u914d\u7f6e"},"\u914d\u7f6e"),Object(i.b)("ol",null,Object(i.b)("li",{parentName:"ol"},"\u5728 ",Object(i.b)("a",Object(r.a)({parentName:"li"},{href:"https://docs.djangoproject.com/en/2.2/ref/settings/"}),"Django settings")," \u4e2d\u5bfc\u5165",Object(i.b)("inlineCode",{parentName:"li"},"lightning.settings"),"\u4e0b\u7684\u914d\u7f6e")),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-python"}),"from lightning.settings import *\n")),Object(i.b)("ol",{start:2},Object(i.b)("li",{parentName:"ol"},"\u5728 ",Object(i.b)("a",Object(r.a)({parentName:"li"},{href:"https://docs.djangoproject.com/en/2.2/ref/settings/"}),"Django settings")," \u7684",Object(i.b)("inlineCode",{parentName:"li"},"INSTALLED_APPS"),"\u4e2d\u6dfb\u52a0",Object(i.b)("inlineCode",{parentName:"li"},"lightning.APPS"))),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-python"}),"import lightning\nINSTALLED_APPS += lightning.APPS\n")),Object(i.b)("ol",{start:3},Object(i.b)("li",{parentName:"ol"},"\u914d\u7f6e\u6839\u8def\u7531\uff0c\u5728\u9879\u76ee\u7684urls.py\u4e2d\uff0c\u628a",Object(i.b)("inlineCode",{parentName:"li"},"lightning.urls"),"\u7684\u8def\u7531\u6dfb\u52a0\u5230\u6700\u540e\u4e00\u884c\u3002")),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-python"}),"from django.urls import path, include\n\nurlpatterns = [\n # ...\n path('', include('lightning.urls')), # \u6dfb\u52a0\u5230\u6700\u540e\u4e00\u884c\n]\n")),Object(i.b)("h3",{id:"migrate"},"Migrate"),Object(i.b)("p",null,"\u9700\u8981migrate\u4e00\u6b21\uff0c\u4e3alightning\u5c31\u7528\u521b\u5efa\u6570\u636e\u8868\u3002"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-sh"}),"./manage.py migrate\n")),Object(i.b)("h3",{id:"\u751f\u6210\u7ba1\u7406\u754c\u9762"},"\u751f\u6210\u7ba1\u7406\u754c\u9762"),Object(i.b)("p",null,"\u4f7f\u7528",Object(i.b)("inlineCode",{parentName:"p"},"./manage.py light <app_label>")," \u751f\u6210\u6307\u5b9a\u5e94\u7528\u7684\u9875\u9762\u914d\u7f6e\u5185\u5bb9"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-sh"}),"./manage.py light my_app\n")),Object(i.b)("h3",{id:"\u8fd0\u884c"},"\u8fd0\u884c"),Object(i.b)("p",null,"\u4f7f\u7528",Object(i.b)("inlineCode",{parentName:"p"},"./manage.py runserver")," \u8fd0\u884cDjango\u9879\u76ee"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-sh"}),"./manage.py runserver\n")),Object(i.b)("p",null,"\u6b64\u65f6\uff0c\u901a\u8fc7\u6d4f\u89c8\u5668\u6253\u5f00 http://localhost:8000/lightning \u5373\u53ef\u8fdb\u5165\u7ba1\u7406\u754c\u9762\uff0c\u4f7f\u7528\u7ba1\u7406\u5458\u5e10\u53f7\u767b\u5f55\u5373\u53ef\u3002\u82e5\u672a\u6709\u5e10\u53f7\uff0c\u4f7f\u7528",Object(i.b)("inlineCode",{parentName:"p"},"./manage.py createsuperuser")," \u547d\u4ee4\u521b\u5efa\u4e00\u4e2a\u3002"))}b.isMDXComponent=!0}}]);