title: How to run FastAPI application from Poetry?
body: <p>I have a fastapi project built by poetry. I want to run the application with a scripts section in pyproject.tom like below:</p>
  <pre class="lang-bash prettyprint-override"><code>poetry run start
  </code></pre>
  <p>What is inside double quotes in the section?</p>
  <pre class="lang-ini prettyprint-override"><code>[tool.poetry.scripts]
  start = &quot;&quot;
  </code></pre>
  <p>I tried to run the following script.</p>
  <pre class="lang-py prettyprint-override"><code>import uvicorn
  from fastapi import FastAPI
  
  app = FastAPI()
  
  @app.get(&quot;/&quot;)
  async def root():
      return {&quot;message&quot;: &quot;Hello World&quot;}
  
  def main():
      print(&quot;Hello World&quot;)
      uvicorn.run(app, host=&quot;0.0.0.0&quot;, port=8000, reload=True, workers=2)
  
  if __name__ == &quot;__main__&quot;:
      main()
  </code></pre>
  <p>It stops the application and just shows warning like this.</p>
  <blockquote>
  <p>WARNING:  You must pass the application as an import string to enable 'reload' or 'workers'.</p>
  </blockquote>