Skip to content

Commit e833cd0

Browse files
howieleungvipinnair22
authored andcommitted
execute gunicorn.conf.py manually (#102)
1 parent eabb977 commit e833cd0

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,16 +221,21 @@ You can optionally use a local development server to test app changes locally. M
221221
4. Duplicate `src/.env.sample` and name to `.env`.
222222

223223
5. Fill in the environment variables in `.env`.
224+
225+
6. (Optional) If you have change in `gunicorn.conf.py`, execute:
226+
```shell
227+
python gunicorn.conf.py
228+
```
224229

225-
6. Run the local server:
230+
7. Run the local server:
226231

227232
```shell
228233
python -m uvicorn "api.main:create_app" --factory --reload
229234
```
230235

231-
7. Click 'http://127.0.0.1:8000' in the terminal, which should open a new tab in the browser.
236+
8. Click 'http://127.0.0.1:8000' in the terminal, which should open a new tab in the browser.
232237

233-
8. Enter your message in the box.
238+
9. Enter your message in the box.
234239
</details>
235240

236241
### Deploying Steps

src/gunicorn.conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,8 @@ def on_starting(server):
272272
worker_class = "uvicorn.workers.UvicornWorker"
273273

274274
timeout = 120
275+
276+
if __name__ == "__main__":
277+
print("Running initialize_resources directly...")
278+
asyncio.run(initialize_resources())
279+
print("initialize_resources finished.")

0 commit comments

Comments
 (0)