# Path: targetexplorer/utils.py
# def get_installed_resource_filepath(relative_path):
#     """Get the full path to one of the resource files shipped with TargetExplorer.
#     In the source distribution, these files are in ``targetexplorer/resources``,
#     but on installation, they are moved to somewhere in the user's python
#     site-packages directory.
#     This function uses the pkg_resources package to find the file within the installation directory
#     structure.
# 
#     Parameters
#     ----------
#     relative_path : str
#         Path of the file to load (relative to the ``targetexplorer`` source folder).
# 
#     Examples
#     --------
#     get_installed_resource_filename('resources/template-wsgi.py')
#     """
#     filepath = resource_filename(targetexplorer.__name__, relative_path)
#     if not os.path.exists(filepath):
#         raise ValueError(
#             "Sorry! {0} does not exist."
#             "If you just added it, you'll have to re-install".format(relative_path)
#         )
#     return filepath


import os
import shutil
import datetime
import targetexplorer
from targetexplorer.utils import get_installed_resource_filepath
from targetexplorer.core import write_yaml_file, logger, project_config_filename, database_filename
from targetexplorer.core import external_data_dirpath, wsgi_filename, manual_overrides_filename
        from targetexplorer.flaskapp import db, app
        from targetexplorer.flaskapp import db, models
            os.path.dirname(targetexplorer.__file__)
        )
        self.sqlalchemy_database_uri = 'sqlite:///' + os.path.join(self.project_path, database_filename)

    def mk_project_dirs(self):
        if not os.path.exists(external_data_dirpath):
            os.mkdir(external_data_dirpath)

    def mk_project_config_file(self):
        if not os.path.exists(project_config_filename):
            config_data = {
                'db_name': self.db_name,
                'sqlalchemy_database_uri': self.sqlalchemy_database_uri,
                'dbapi_name': self.db_name + 'DBAPI',
                'ncrawls_to_save': self.ncrawls_to_save,
                'uniprot_query': self.uniprot_query,
                'uniprot_domain_regex': self.uniprot_domain_regex,
                'ignore_uniprot_pdbs': None,
            }
            write_yaml_file(config_data, project_config_filename)

    def write_wsgi_file(self):
        if not os.path.exists(wsgi_filename):
            template_wsgi_filepath = get_installed_resource_filepath(
                os.path.join('resources', 'template-wsgi.py')
            )
            shutil.copy(template_wsgi_filepath, wsgi_filename)

    def write_manual_overrides_file(self):
        if not os.path.exists(manual_overrides_filename):

# Path: targetexplorer/utils.py
# def get_installed_resource_filepath(relative_path):
#     """Get the full path to one of the resource files shipped with TargetExplorer.
#     In the source distribution, these files are in ``targetexplorer/resources``,
#     but on installation, they are moved to somewhere in the user's python
#     site-packages directory.
#     This function uses the pkg_resources package to find the file within the installation directory
#     structure.
# 
#     Parameters
#     ----------
#     relative_path : str
#         Path of the file to load (relative to the ``targetexplorer`` source folder).
# 
#     Examples
#     --------
#     get_installed_resource_filename('resources/template-wsgi.py')
#     """
#     filepath = resource_filename(targetexplorer.__name__, relative_path)
#     if not os.path.exists(filepath):
#         raise ValueError(
#             "Sorry! {0} does not exist."
#             "If you just added it, you'll have to re-install".format(relative_path)
#         )
#     return filepath


# Path: targetexplorer/initproject.py
import os
import shutil
import datetime
import targetexplorer
from targetexplorer.utils import get_installed_resource_filepath
from targetexplorer.core import write_yaml_file, logger, project_config_filename, database_filename
from targetexplorer.core import external_data_dirpath, wsgi_filename, manual_overrides_filename
        from targetexplorer.flaskapp import db, app
        from targetexplorer.flaskapp import db, models

            os.path.dirname(targetexplorer.__file__)
        )
        self.sqlalchemy_database_uri = 'sqlite:///' + os.path.join(self.project_path, database_filename)

    def mk_project_dirs(self):
        if not os.path.exists(external_data_dirpath):
            os.mkdir(external_data_dirpath)

    def mk_project_config_file(self):
        if not os.path.exists(project_config_filename):
            config_data = {
                'db_name': self.db_name,
                'sqlalchemy_database_uri': self.sqlalchemy_database_uri,
                'dbapi_name': self.db_name + 'DBAPI',
                'ncrawls_to_save': self.ncrawls_to_save,
                'uniprot_query': self.uniprot_query,
                'uniprot_domain_regex': self.uniprot_domain_regex,
                'ignore_uniprot_pdbs': None,
            }
            write_yaml_file(config_data, project_config_filename)

    def write_wsgi_file(self):
        if not os.path.exists(wsgi_filename):
            template_wsgi_filepath = get_installed_resource_filepath(
                os.path.join('resources', 'template-wsgi.py')
            )
            shutil.copy(template_wsgi_filepath, wsgi_filename)

    def write_manual_overrides_file(self):
        if not os.path.exists(manual_overrides_filename):

            template_manual_overrides_filepath = get_installed_resource_filepath(