Skip to content

Commit c01a6b1

Browse files
Merge pull request #81 from KreativeThinker/master
chore: add run command and update readme
2 parents 41c6b9d + 05c6536 commit c01a6b1

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ A CTF platform backend written in [FastAPI](https://github.com/fastapi/fastapi)
2626

2727
Before you begin, ensure you have met the following requirements:
2828

29-
- Python 3.7+
29+
- Python 3.7+ (< Python 3.13)
3030
- Docker (optional, for container functionality)
3131

3232
## Installation
@@ -41,7 +41,7 @@ Before you begin, ensure you have met the following requirements:
4141
2. Set up a virtual environment:
4242

4343
```bash
44-
python3 -m venv .venv
44+
python3.12 -m venv .venv
4545
source .venv/bin/activate
4646
```
4747

@@ -62,11 +62,14 @@ Before you begin, ensure you have met the following requirements:
6262
1. Start:
6363

6464
```bash
65-
cd src
6665
uvicorn pwncore:app --reload
66+
67+
# OR
68+
69+
poetry run dev
6770
```
6871

69-
2. Access the auto-generated documentation at [http://localhost:8000/docs](http://localhost:8000/docs)
72+
2. Access the auto-generated documentation at [http://localhost:8080/docs](http://localhost:8080/docs)
7073

7174
3. Docker configuration:
7275
- Enable and start the Docker service on your system, or

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,7 @@ pretty = true
6464
[build-system]
6565
requires = ["poetry-core"]
6666
build-backend = "poetry.core.masonry.api"
67+
68+
69+
[tool.poetry.scripts]
70+
dev = "pwncore.__main__:run_dev"

src/pwncore/__main__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
from pwncore import app # noqa
1+
import uvicorn
22

3-
# I do not trust my self to call uvicorn from here for debugging and
4-
# not use that in production
3+
4+
def run_dev():
5+
uvicorn.run("pwncore:app", host="127.0.0.1", port=8080, reload=True)
6+
7+
8+
if __name__ == "__main__":
9+
run_dev()

0 commit comments

Comments
 (0)