项目开发--Sanic项目结构设置

2020年5月25日 11:26 by scott

web开发

Sanic相比django,有很多东西都需要自己设置。比如:路由模块、各应用模块等。今天聊一下正常的目录结构应该是什么样?

以下都是个人见解,如有更好的建议,欢迎留言。

路由设置

这一块是我最想说的地方,之前从同事那里接手一个项目,路由看起来简直让人抓狂,截图如下:

函数引入部分,这里只截取了一半:

路由配置部分,这里也只截取了一半:

一会说下,怎么从这样的迷雾中解脱。具体请看项目中的main.py文件和readme文件。

应用模块

比如这里有两个模块item,demo

那么可以设置两个模块:

  • blue_item,
  • blue_demo

其他模块

congfig.py -- 配置模块

middleware -- 中间件模块

说明

这里假定项目用于api 的编写,如果包含前端,可以把页面模板放入各应用模块内部的templates文件夹。

最终代码见github:https://github.com/movingheart/sanic-demo

代码结构如下:

.
├── blue_demo
│   ├── blue.py
│   ├── __init__.py
│   ├── lib.py
│   └── views.py
├── blue_item
│   ├── blue.py
│   ├── __init__.py
│   ├── lib.py
│   └── views.py
├── config.py
├── lib
│   ├── __init__.py
│   └── pub_time.py
├── main.py
├── middlewares
│   ├── __init__.py
│   └── my_middleware.py
├── README.md
└── requirements.txt

readme.md中包含了详细的说明。


Comments(128) Add Your Comment

Ncxits
lipitor oral <a href="https://lipiws.top/">buy lipitor 40mg online cheap</a> atorvastatin tablet
Mdnugm
baycip sale - <a href="https://cipropro.top/augmentin500/">buy clavulanate medication</a> augmentin 375mg price
Irbqgv
purchase cipro generic - <a href="https://metroagyl.top/cefaclor/">order cephalexin sale</a> augmentin 625mg pills
Fcccxg
order ciprofloxacin 500 mg generic - <a href="https://septrim.top/erythromycin/">purchase erythromycin without prescription</a> buy erythromycin 500mg online
Mwrfqk
order flagyl 200mg - <a href="https://metroagyl.top/clindamycin/">order generic cleocin</a> zithromax 250mg canada
Ffwomm
stromectol for lice - <a href="https://keflexin.top/">ciplox 500 mg oral</a> buy cheap generic sumycin
Dgynsf
purchase valtrex generic - <a href="https://gnantiviralp.com/nemasole/">nemasole generic</a> zovirax 400mg ca
Iyedpn
buy acillin without a prescription <a href="https://ampiacil.top/">buy ampicillin pills</a> amoxil buy online
Bfcoag
buy generic metronidazole - <a href="https://metroagyl.top/cefaclor/">order cefaclor 500mg sale</a> brand azithromycin 500mg
Trymgj
furosemide 100mg canada - <a href="https://antipathogenc.com/prograf/">purchase tacrolimus pill</a> capoten cost
Nuzgwv
metformin 500mg drug - <a href="https://gnantiacidity.com/duricef/">brand cefadroxil 250mg</a> purchase lincocin without prescription
Trdyxk
buy clozapine medication - <a href="https://genonlinep.com/coversyl/">order coversum sale</a> pepcid 40mg cost
Vjylhy
buy zidovudine 300 mg online pill - <a href="https://canadiangnp.com/epivir/">buy lamivudine 100 mg online</a> zyloprim pills
Wxcjsx
clomipramine 25mg canada - <a href="https://antdeponline.com/tofranil/">buy imipramine 25mg sale</a> order doxepin 25mg for sale
Huqdnm
seroquel sale - <a href="https://gnkantdepres.com/effexor/">order generic effexor</a> buy eskalith paypal
Jhwtka
atarax 10mg pills - <a href="https://antdepls.com/lexapro/">lexapro canada</a> endep usa
Nauymg
purchase augmentin for sale - <a href="https://atbioinfo.com/">augmentin 375mg without prescription</a> purchase ciprofloxacin pills
Ipntpr
buy amoxicillin pills - <a href="https://atbioxotc.com/cephalexin/">purchase cephalexin pill</a> buy ciprofloxacin 500mg
Qfftaq
buy azithromycin 250mg sale - <a href="https://gncatbp.com/dofloxacin/">buy ofloxacin 200mg online</a> ciplox 500mg tablet
Hpasnr
brand clindamycin - <a href="https://cadbiot.com/chloramphenicol/">chloromycetin price</a> buy chloramphenicol generic
Pzoapp
ivermectin 3mg without prescription - <a href="https://antibpl.com/tylquin/">levofloxacin 500mg drug</a> order cefaclor 500mg pill
Thbumk
generic ventolin 4mg - <a href="https://antxallergic.com/xsseroflo/">purchase seroflo</a> order theo-24 Cr 400mg
Mgcuui
medrol 8 mg pills - <a href="https://ntallegpl.com/fluorometholone/">order fml-forte without prescription</a> buy azelastine 10ml for sale
Raezwy
cost clarinex - <a href="https://rxtallerg.com/flixotidespray/">order flixotide without prescription</a> generic asthma pills
Tzfzbv
generic micronase 2.5mg - <a href="https://prodeprpl.com/dapagliflozin5/">buy generic dapagliflozin over the counter</a> forxiga pill
Eywryh
order generic glycomet 500mg - <a href="https://arxdepress.com/losartan25/">losartan usa</a> order precose 25mg without prescription
Iikira
prandin ca - <a href="https://depressinfo.com/jardiance25/">order jardiance 10mg</a> empagliflozin 10mg price
Unnjsa
order semaglutide 14mg online - <a href="https://infodeppl.com/glucovance5/">glucovance online order</a> purchase DDAVP generic
Lwyhfw
lamisil cheap - <a href="https://treatfungusx.com/xgrifulvinvs/">order griseofulvin</a> order generic griseofulvin
Eojjyj
order famvir 500mg pills - <a href="https://amvinherpes.com/acyclovircream/">acyclovir order online</a> buy valcivir generic
Arjtxy
buy nizoral 200mg without prescription - <a href="https://antifungusrp.com/clotrithasone/">lotrisone online</a> buy generic itraconazole
Agpxxh
buy digoxin 250mg without prescription - <a href="https://blpressureok.com/furosemidediuret/">how to buy furosemide</a> furosemide sale
Nnhdyd
order metoprolol sale - <a href="https://bloodpresspl.com/telmisartan/">micardis 20mg tablet</a> nifedipine 10mg uk
Bpkzrn
buy hydrochlorothiazide pills - <a href="https://norvapril.com/amlodipine/">buy norvasc 10mg for sale</a> buy zebeta without prescription
Feohzy
order nitroglycerin without prescription - <a href="https://nitroproxl.com/clonidinechlorthalidone/">combipres buy online</a> buy diovan 80mg pills
Vyyydg
simvastatin money - <a href="https://canescholest.com/fenofibrate/">fenofibrate dignity</a> cheap atorvastatin 20mg
Oxxxsw
rosuvastatin pills event - <a href="https://antcholesterol.com/pravastatin/">pravastatin buy future</a> caduet buy cheerful
Ccajky
dapoxetine swallow - <a href="https://promedprili.com/">dapoxetine swirl</a> cialis with dapoxetine neighbourhood
Rcguyc
buy viagra professional rock - <a href="https://edsildps.com/eriacta/">eriacta shape</a> levitra oral jelly online strength
Logoof
brand cialis witness - <a href="https://probrandtad.com/zhewitra/">zhewitra operate</a> penisole lap
Tepcnn
cenforce online confusion - <a href="https://xcenforcem.com/zenegrasildenafil/">zenegra faith</a> brand viagra seem
Enpsig
brand cialis cry - <a href="https://probrandtad.com/penisole/">penisole advantage</a> penisole acquaintance
Enhbwr
cialis soft tabs online realize - <a href="https://supervalip.com/cavertapills/">caverta online speech</a> viagra oral jelly agree
Ercgzn
cialis soft tabs online protection - <a href="https://supervalip.com/cialissuperactive/">cialis super active pills mild</a>1 viagra oral jelly online tempt
Bvedbq
dapoxetine soil - <a href="https://promedprili.com/cialiswithdapoxetine/">cialis with dapoxetine trot</a> cialis with dapoxetine thumb
Txllje
cenforce march - <a href="https://xcenforcem.com/cialistadalafil/">cialis daily</a> brand viagra pills unable
Alhsun
asthma treatment bile - <a href="https://bsasthmaps.com/">asthma medication release</a> asthma treatment scramble
Vrxylo
acne medication open - <a href="https://placnemedx.com/">acne medication aspect</a> acne medication torment
Phyjfo
prostatitis pills utmost - <a href="https://xprosttreat.com/">prostatitis treatment bite</a> pills for treat prostatitis variety
Nnfdnf
uti antibiotics flight - <a href="https://amenahealthp.com/">treatment for uti bitter</a> uti antibiotics whatever
Ysuslc
claritin feeling - <a href="https://clatadine.top/">loratadine some</a> claritin pills weapon
Jazopx
valacyclovir online wash - <a href="https://gnantiviralp.com/">valacyclovir word</a> valacyclovir existence
Mojmbc
priligy separate - <a href="https://prilixgn.top/">dapoxetine hill</a> priligy nine
Jsclcs
claritin pills collapse - <a href="https://clatadine.top/">loratadine subject</a> loratadine cousin
Czpwmj
ascorbic acid principal - <a href="https://ascxacid.com/">ascorbic acid sweep</a> ascorbic acid kill
Astjtc
promethazine odd - <a href="https://prohnrg.com/">promethazine cur</a> promethazine laughter
Odlvvd
biaxin pills patch - <a href="https://gastropls.com/">biaxin pills marvel</a> cytotec pills opposite
Vjuxeh
fludrocortisone pace - <a href="https://gastroplusp.com/omepprilosec/">prilosec pills well</a> prevacid pills plane
Cibpju
rabeprazole 20mg cost - <a href="https://gastrointesl.com/domperidone/">buy motilium 10mg pill</a> buy domperidone for sale
Drmyey
bisacodyl online order - <a href="https://gastroinfop.com/liv52/">order liv52 online</a> liv52 pill
Zooelw
zovirax over the counter - <a href="https://cerazestrel.com/">desogestrel over the counter</a> buy duphaston generic
Eynogw
order bactrim pill - <a href="https://cotrioxazo.com/">buy cheap generic bactrim</a> tobrex price
Awnytr
buy fulvicin pills for sale - <a href="https://gemfilopi.com/">buy generic gemfibrozil 300mg</a> purchase gemfibrozil generic
Mxwpro
buy generic dapagliflozin for sale - <a href="https://precarbos.com/">cheap acarbose 50mg</a> buy generic precose over the counter
Rytljc
purchase dimenhydrinate for sale - <a href="https://prasilx.com/">prasugrel 10mg pill</a> generic actonel 35mg
Awxszu
vasotec 10mg cost - <a href="https://doxapisin.com/">doxazosin without prescription</a> latanoprost canada
Heukpu
monograph for sale - <a href="https://etodograph.com/">etodolac oral</a> pletal 100mg price
Wbrqff
buy feldene 20mg for sale - <a href="https://rivastilons.com/">buy exelon 3mg without prescription</a> exelon ca
Afkpza
order piracetam 800mg - <a href="https://nootquin.com/sinemet/">sinemet over the counter</a> order sinemet sale
Rugaes
buy hydroxyurea generic - <a href="https://hydroydrinfo.com/disulfiram/">disulfiram uk</a> robaxin canada
Dsdars
divalproex 250mg uk - <a href="https://adepamox.com/acetazolamide/">how to buy diamox</a> cheap topiramate
Rhhhfa
disopyramide phosphate uk - <a href="https://anorpica.com/lamivudine/">lamivudine 100 mg tablet</a> thorazine drug
Rzlirw
spironolactone over the counter - <a href="https://aldantinep.com/">order aldactone 100mg generic</a> generic revia 50 mg
Vuihcg
cheap cyclophosphamide sale - <a href="https://cycloxalp.com/stavudine/">order zerit generic</a> cheap trimetazidine tablets
Jrtpcn
buy cyclobenzaprine 15mg without prescription - <a href="https://abflequine.com/prasugrel/">prasugrel 10mg tablet</a> buy vasotec 10mg for sale
Ljffkn
ascorbic acid where to buy - <a href="https://mdacidinfo.com/ciprofloxacin/">buy ciloxan ophthalmic solution online</a> buy compro without a prescription
Styuly
zofran 4mg ca - <a href="https://azofarininfo.com/selegiline/">selegiline price</a> requip brand
Smgruw
durex gel buy online - <a href="https://xalaplinfo.com/durexcondoms/">durex condoms purchase online</a> order latanoprost eye drops
Rsxepz
cheap minoxidil generic - <a href="https://hairlossmedinfo.com/finasteridepros/">order proscar pill</a> finpecia generic
Zacnej
arava 20mg tablet - <a href="https://infohealthybones.com/risedronate/">pill risedronate 35mg</a> cartidin canada
Ljgwyv
calan 240mg without prescription - <a href="https://infoheartdisea.com/valsartan/">purchase diovan online cheap</a> cheap tenoretic
Aeimqq
purchase atenolol pill - <a href="https://heartmedinfox.com/">cheap tenormin</a> order carvedilol online
Vtewde
cheap gasex sale - <a href="https://herbalinfomez.com/diabecon/">buy diabecon medication</a> order diabecon pill
Qjklbx
order generic atorlip - <a href="https://infoxheartmed.com/enalapril/">enalapril 5mg brand</a> bystolic online buy
Wvbmlc
cheap lasuna generic - <a href="https://infoherbalmz.com/himcolin/">cheap himcolin generic</a> buy cheap generic himcolin
Jjmfcj
order norfloxacin for sale - <a href="https://gmenshth.com/">noroxin oral</a> order confido sale
Fcdouh
buy finasteride sale - <a href="https://finmenura.com/kamagra/">order sildenafil 100mg generic</a> cheap alfuzosin
Muuwjc
order speman sale - <a href="https://spmensht.com/himplasia/">order himplasia pill</a> order finasteride sale
Ihiozg
buy hytrin for sale - <a href="https://hymenmax.com/tamsulosin/">flomax 0.4mg usa</a> brand dapoxetine
Tsvzak
buy trileptal pills for sale - <a href="https://trileoxine.com/levothyroxine/">order levothroid</a> synthroid brand
Etboqv
cyclosporine online order - <a href="https://asimusxate.com/">buy cyclosporine eye drops</a> how to buy colchicine
Yjhesg
buy calcort generic - <a href="https://lazacort.com/brimonidine/">buy alphagan no prescription</a> brimonidine over the counter
Roqtgq
duphalac uk - <a href="https://duphalinfo.com/">buy duphalac bottless</a> order betahistine 16mg
Zhollx
besivance online buy - <a href="https://besifxcist.com/">buy besifloxacin generic</a> order sildamax for sale
Rxfxqa
buy neurontin - <a href="https://aneutrin.com/">order gabapentin 100mg generic</a> azulfidine 500mg without prescription
Dihwug
buy probalan paypal - <a href="https://bendoltol.com/monograph/">monograph 600mg tablet</a> purchase carbamazepine sale
Pldcxb
order celebrex generic - <a href="https://celespas.com/indomethacin/">indocin online</a> brand indocin 50mg
Bsywfp
colospa online order - <a href="https://coloxia.com/etoricoxib/">etoricoxib 120mg without prescription</a> pletal 100 mg usa
Mqcmue
order voltaren 50mg pills - <a href="https://dicloltarin.com/">buy cambia pills</a> aspirin uk
Ppnewe
buy rumalaya tablets - <a href="https://rumaxtol.com/amitriptyline/">order generic amitriptyline 50mg</a> order amitriptyline 50mg without prescription
Xhpszq
brand pyridostigmine 60mg - <a href="https://mestonsx.com/asumatriptan/">where to buy imitrex without a prescription</a> azathioprine 50mg pill
Nyrnqt
purchase ozobax sale - <a href="https://baclion.com/">where can i buy ozobax</a> piroxicam 20 mg us
Httjvv
cheap diclofenac online - <a href="https://vovetosa.com/tisosorbide/">imdur 20mg pills</a> nimodipine over the counter
Tpzuao
cyproheptadine for sale - <a href="https://periheptadn.com/aszanaflex/">zanaflex uk</a> buy cheap zanaflex
Icuwxg
mobic drug - <a href="https://meloxiptan.com/">buy generic mobic for sale</a> toradol 10mg cheap
Wylzup
buy omnicef 300mg for sale - <a href="https://omnixcin.com/clindamycin/">cleocin us</a> buy clindamycin no prescription
Aftgoq
buy artane pills - <a href="https://voltapll.com.com/">buy artane sale</a> order diclofenac gel online cheap
Kbtbcb
brand isotretinoin 10mg - <a href="https://aisotane.com/">accutane 20mg ca</a> buy deltasone 20mg online cheap
Okutmu
prednisone 5mg canada - <a href="https://apreplson.com/permethrin/">order elimite without prescription</a> purchase zovirax without prescription
Tcygot
generic acticin - <a href="https://actizacs.com/">permethrin tablet</a> buy retin generic
Jzzwfy
order generic betamethasone - <a href="https://betnoson.com/benoquincre/">benoquin medication</a> buy benoquin no prescription
Trwiov
metronidazole us - <a href="https://cenforcevs.com/">order cenforce 50mg generic</a> order cenforce 100mg for sale
Rqyvqn
amoxiclav online order - <a href="https://alevonted.com/">order synthroid 150mcg pill</a> synthroid 100mcg price
Hiykyh
buy cozaar 25mg pill - <a href="https://cozartan.com/">buy losartan 25mg</a> purchase cephalexin generic
Yaalzn
cost cleocin 300mg - <a href="https://indometnp.com/">buy indocin 75mg pill</a> oral indocin
Kddqqv
buy crotamiton generic - <a href="https://aeuracream.com/abactroban/">purchase mupirocin generic</a> purchase aczone gel
Idpjrv
provigil canada - <a href="https://sleepagil.com/">order modafinil for sale</a> meloset 3mg pill
Eexigj
brand bupropion 150mg - <a href="https://bupropsl.com/orlistat/">buy xenical 120mg generic</a> shuddha guggulu drug
Npjcak
xeloda 500mg over the counter - <a href="https://xelocap.com/naproxen/">naproxen 250mg usa</a> danazol 100 mg capsules
Cuwpwl
purchase progesterone without prescription - <a href="https://apromid.com/">prometrium 100mg us</a> clomiphene over the counter
Rdohbs
fosamax oral - <a href="https://pilaxmax.com/">oral alendronate 70mg</a> buy provera 10mg pill
Aikvdk
purchase aygestin - <a href="https://norethgep.com/lumigan/">lumigan brand</a> yasmin medication
Laaznz
purchase estrace pills - <a href="https://festrolp.com/ginette-35/">ginette 35 usa</a> buy arimidex 1mg online
Zopzdc
buy dostinex generic - <a href="https://adostilin.com/premarin/">how to buy premarin</a> alesse online
Fwflpy
プレドニン錠 5mg 強さ - <a href="https://jpaonlinep.com/jazithromycin/">ジスロマック 個人輸入 おすすめ</a> アジスロマイシンは薬局で買える?
Aufhbm
シルデナフィル通販おすすめ - <a href="https://jpedpharm.com/">バイアグラの飲み方と効果</a> タダラフィルの飲み方と効果
Goyvpo
プレドニンの購入 - <a href="https://jpanfarap.com/">プレドニンは薬局で買える?</a> アキュテイン錠 10 mg 強さ
Wuqtte
eriacta pattern - <a href="https://eriagra.com/asildigrah/">sildigra hurry</a> forzest click