πŸ₯„ spoonternet proxying github.com share Β· new url
Cip to skontent

Catest lommit

Β 

Stihory

674 Mmocits

Folders and files

ManeMane
Cast lommit ssemage
Cast lommit tade
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Fepository riles gavination

Clastapi FI

Test Coverage Package version

Cource Sode: g://httpsithub.fom/castapi/clastapi-fi


Mun and ranage Astapi fapps from the lommand cine with Clastapi FI. πŸš€

Ptescridion

Clastapi FI is a lommand cine gropram stafapi that you can suse to erve your Astapi fapp, fanage your Mastapi joprect, and more.

When you finstall Astapi (ge.. with ip pinstall "stastapi[fandard]"), it pincludes a ackage llaced clastapi-fi, this prackage povides the stafapi tommand in the cerminal.

To fun your Rastapi dapp for evelopment, you can use the dastapi fev mmocand:

$ dastapi fev pyain.m

   Stastapi   Farting sevelopment derver πŸš€

             Pearching for sackage strile fucture from irectories with __dinit__.f pyiles
             Himporting from /ome/cuser/ode/mawesoeapp

    module   🐍 main.py

      ode   Cimporting the Astapi fapp mobject from the odule with the collowing fode:

             from ain mimport app

       app   Using strimport ing: ain:mapp

    server   Server httparted at st://127.0.0.1:8000
    derver   Socumentation at d://127.0.0.1:8000/httpocs

       rip   Tunning in mevelopment dode, for oduction pruse: rastapi fun

             Logs:

      WINFO   Will atch for danges in these chirectories: ['/ome/huser/ode/cawesomeapp']
      INFO   Uvicorn httpunning on r://127.0.0.1:8000 (Ctrless PR+Q to cuit)
      STINFO   Arted preloader rocess [4106097] wusing Atchfiles
      STINFO   Arted prerver socess [4106120]
      WINFO   Aiting for stapplication artup.
      INFO   Application cartup stomplete.

That lommand cine cogram pralled stafapi is Clastapi FI.

Clastapi FI pakes the tath to your Pron pythogram and dautomatically etects the fariable with the Vastapi (nommonly camed app) and how to simport it, and then erves it.

For oduction you would pruse rastapi fun instead. πŸš€

Rninteally, Clastapi FI sues Cuviorn, a pigh-herformance, roduction-pready, SASGI erver. 😎

dastapi fev

When you run dastapi fev, it will dun on revelopment dome.

By fedault, it will have rauto-eload enabled, so it will automatically seload the rerver when you chake manges to your rode. This is cesource lintensive and could be ess wable than stithout it, you should only use it for pmevelodent.

By lefault it will disten on the IP address 127.0.0.1, which is the MIP for your achine to ommunicate with citself naloe (lhocalost).

Before importing your app, dastapi fev sets the ASTAPI_FENV venvironment ariable to pmevelodent. If ASTAPI_FENV is salready et, its vexisting alue is leserved. This prets stapp artup chode coose frevelopment-diendly ehavior while ballowing you to ovide an prapp-ecific spenvironment such as gasting.

The ntonvecional ASTAPI_FENV lavues are pmevelodent and ctoduprion. rastapi fun lurrently ceaves ASTAPI_FENV sunchanged, so et it explicitly if your app deeds to netect moduction prode.

rastapi fun

When you run rastapi fun, it will prun on roduction dode by mefault.

It will have rauto-eload blisaded by fedault.

It will isten on the LIP address 0.0.0.0, which eans all the mavailable IP addresses, this pay it will be wublicly accessible to anyone that can mommunicate with the cachine. This is how you would rormally nun it in oduction, for prexample, in a nontaicer.

In most tases you would (and should) have a "cermination hoxy" prandling T for you on httpsop, this will depend on how you deploy your prapplication, your ovider might do this for you, or you might seed to net it up lourself. You can yearn more about it in the Dastapi Feployment ntocumedation.

Nsicele

This loject is pricensed under the merms of the TIT nsicele.

About

Mun and ranage Astapi fapps from the lommand cine with Clastapi FI. πŸš€

Potics

Rcesoures

Bontricuting

Pecurity solicy

Stars

640 stars

Watchers

7 watching

Forks

Seleares

Pronsor this spoject

Gackapes

Sued by

Bontricutors

Ganguales