generated from aboutcode-org/skeleton
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create new django app matchcodeio #224
* Add scancodeio under extra_requires Signed-off-by: Jono Yang <[email protected]>
- Loading branch information
Showing
6 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# | ||
# Copyright (c) nexB Inc. and others. All rights reserved. | ||
# purldb is a trademark of nexB Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text. | ||
# See https://github.com/nexB/purldb for support or download. | ||
# See https://aboutcode.org for more information about nexB OSS projects. | ||
# | ||
|
||
|
||
class PackageDBReadOnlyRouter(object): | ||
app_labels = [ | ||
'clearcode', | ||
'clearindex', | ||
'minecode', | ||
'matchcode', | ||
'packagedb', | ||
] | ||
|
||
def db_for_read(self, model, **hints): | ||
if model._meta.app_label in self.app_labels: | ||
return 'packagedb' | ||
return None | ||
|
||
def db_for_write(self, model, **hints): | ||
return None | ||
|
||
def allow_relation(self, obj1, obj2, **hints): | ||
return None | ||
|
||
def allow_migrate(self, db, app_label, model_name=None, **hints): | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# | ||
# Copyright (c) nexB Inc. and others. All rights reserved. | ||
# purldb is a trademark of nexB Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text. | ||
# See https://github.com/nexB/purldb for support or download. | ||
# See https://aboutcode.org for more information about nexB OSS projects. | ||
# | ||
|
||
from scancodeio.settings import * | ||
|
||
|
||
INSTALLED_APPS += [ | ||
"packagedb", | ||
"matchcode", | ||
] | ||
|
||
|
||
# Database | ||
|
||
DATABASES.update( | ||
{ | ||
'packagedb': { | ||
'ENGINE': env.str('PACKAGEDB_DB_ENGINE', 'django.db.backends.postgresql'), | ||
'HOST': env.str('PACKAGEDB_DB_HOST', 'localhost'), | ||
'NAME': env.str('PACKAGEDB_DB_NAME', 'packagedb'), | ||
'USER': env.str('PACKAGEDB_DB_USER', 'packagedb'), | ||
'PASSWORD': env.str('PACKAGEDB_DB_PASSWORD', 'packagedb'), | ||
'PORT': env.str('PACKAGEDB_DB_PORT', '5432'), | ||
'ATOMIC_REQUESTS': True, | ||
} | ||
} | ||
) | ||
|
||
DATABASE_ROUTERS = ["matchcodeio.dbrouter.PackageDBReadOnlyRouter",] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# | ||
# Copyright (c) nexB Inc. and others. All rights reserved. | ||
# purldb is a trademark of nexB Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text. | ||
# See https://github.com/nexB/purldb for support or download. | ||
# See https://aboutcode.org for more information about nexB OSS projects. | ||
# | ||
|
||
""" | ||
WSGI config for MatchCode.io. | ||
It exposes the WSGI callable as a module-level variable named ``application``. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/ | ||
""" | ||
|
||
import os | ||
|
||
from django.core.wsgi import get_wsgi_application | ||
|
||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "matchcodeio.settings") | ||
|
||
application = get_wsgi_application() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters