add setting port

This commit is contained in:
lan-air
2022-12-12 15:15:17 +08:00
parent 9cf0d9418d
commit fb80d26b70
3 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -207,4 +207,4 @@ async def share(text: str = Form(default=None), style: str = Form(default='2'),
if __name__ == '__main__':
import uvicorn
uvicorn.run('main:app', host='0.0.0.0', port=12345)
uvicorn.run('main:app', host='0.0.0.0', port=settings.PORT, debug=settings.DEBUG)
+2
View File
@@ -4,6 +4,8 @@ config = Config(".env")
DEBUG = config('DEBUG', cast=bool, default=False)
PORT = config('PORT', cast=int, default=12345)
DATABASE_URL = config('DATABASE_URL', cast=str, default="sqlite+aiosqlite:///database.db")
DATA_ROOT = config('DATA_ROOT', cast=str, default="./static")
+2 -2
View File
@@ -33,7 +33,7 @@ class FileSystemStorage:
async def delete_file(self, file):
filepath = self.DATA_ROOT / file['text'].lstrip(self.STATIC_URL + '/')
await asyncio.to_thread(os.remove, filepath)
async def delete_files(self, files):
for file in files:
if file['type'] != 'text':
@@ -42,4 +42,4 @@ class FileSystemStorage:
STORAGE_ENGINE = {
"filesystem": FileSystemStorage
}
}