Skip to content

Commit fb80d26

Browse files
author
lan-air
committed
add setting port
1 parent 9cf0d94 commit fb80d26

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,4 @@ async def share(text: str = Form(default=None), style: str = Form(default='2'),
207207
if __name__ == '__main__':
208208
import uvicorn
209209

210-
uvicorn.run('main:app', host='0.0.0.0', port=12345)
210+
uvicorn.run('main:app', host='0.0.0.0', port=settings.PORT, debug=settings.DEBUG)

settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
DEBUG = config('DEBUG', cast=bool, default=False)
66

7+
PORT = config('PORT', cast=int, default=12345)
8+
79
DATABASE_URL = config('DATABASE_URL', cast=str, default="sqlite+aiosqlite:///database.db")
810

911
DATA_ROOT = config('DATA_ROOT', cast=str, default="./static")

storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async def save_file(self, file, file_bytes, key):
3333
async def delete_file(self, file):
3434
filepath = self.DATA_ROOT / file['text'].lstrip(self.STATIC_URL + '/')
3535
await asyncio.to_thread(os.remove, filepath)
36-
36+
3737
async def delete_files(self, files):
3838
for file in files:
3939
if file['type'] != 'text':
@@ -42,4 +42,4 @@ async def delete_files(self, files):
4242

4343
STORAGE_ENGINE = {
4444
"filesystem": FileSystemStorage
45-
}
45+
}

0 commit comments

Comments
 (0)