add setting port
This commit is contained in:
@@ -207,4 +207,4 @@ async def share(text: str = Form(default=None), style: str = Form(default='2'),
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import uvicorn
|
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)
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ config = Config(".env")
|
|||||||
|
|
||||||
DEBUG = config('DEBUG', cast=bool, default=False)
|
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")
|
DATABASE_URL = config('DATABASE_URL', cast=str, default="sqlite+aiosqlite:///database.db")
|
||||||
|
|
||||||
DATA_ROOT = config('DATA_ROOT', cast=str, default="./static")
|
DATA_ROOT = config('DATA_ROOT', cast=str, default="./static")
|
||||||
|
|||||||
+2
-2
@@ -33,7 +33,7 @@ class FileSystemStorage:
|
|||||||
async def delete_file(self, file):
|
async def delete_file(self, file):
|
||||||
filepath = self.DATA_ROOT / file['text'].lstrip(self.STATIC_URL + '/')
|
filepath = self.DATA_ROOT / file['text'].lstrip(self.STATIC_URL + '/')
|
||||||
await asyncio.to_thread(os.remove, filepath)
|
await asyncio.to_thread(os.remove, filepath)
|
||||||
|
|
||||||
async def delete_files(self, files):
|
async def delete_files(self, files):
|
||||||
for file in files:
|
for file in files:
|
||||||
if file['type'] != 'text':
|
if file['type'] != 'text':
|
||||||
@@ -42,4 +42,4 @@ class FileSystemStorage:
|
|||||||
|
|
||||||
STORAGE_ENGINE = {
|
STORAGE_ENGINE = {
|
||||||
"filesystem": FileSystemStorage
|
"filesystem": FileSystemStorage
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user