Merge pull request #2771 from tourn/bugfix/database-url-with-port

Fix parsing DATABASE_URL with port number
This commit is contained in:
vabene1111 2023-12-02 18:48:41 +01:00 committed by GitHub
commit b069a49954
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -350,7 +350,7 @@ WSGI_APPLICATION = 'recipes.wsgi.application'
# Load settings from env files
if os.getenv('DATABASE_URL'):
match = re.match(
r'(?P<schema>\w+):\/\/(?:(?P<user>[\w\d_-]+)(?::(?P<password>[^@]+))?@)?(?P<host>[^:/]+)(?:(?P<port>\d+))?(?:/(?P<database>[\w\d/._-]+))?',
r'(?P<schema>\w+):\/\/(?:(?P<user>[\w\d_-]+)(?::(?P<password>[^@]+))?@)?(?P<host>[^:/]+)(?::(?P<port>\d+))?(?:/(?P<database>[\w\d/._-]+))?',
os.getenv('DATABASE_URL')
)
settings = match.groupdict()