Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for multi-project scrapy.cfg files #172

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions scrapydweb/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,12 @@ def inject_variable():
protocol = 'http'
context = None

print("{star}Visit ScrapydWeb at {protocol}://127.0.0.1:{port} "
"or {protocol}://IP-OF-THE-CURRENT-HOST:{port}{star}\n".format(
star=STAR, protocol=protocol, port=app.config['SCRAPYDWEB_PORT']))
logger.info("{star}Visit ScrapydWeb at {protocol}://127.0.0.1:{port} "
"or {protocol}://IP-OF-THE-CURRENT-HOST:{port}{star}\n".format(
star=STAR, protocol=protocol, port=app.config['SCRAPYDWEB_PORT']))
logger.info("For running Flask in production, check out http://flask.pocoo.org/docs/1.0/deploying/")
apscheduler_logger.setLevel(logging.DEBUG)
app.run(host=app.config['SCRAPYDWEB_BIND'], port=app.config['SCRAPYDWEB_PORT'],
ssl_context=context, use_reloader=False)
return app


def load_custom_settings(config):
Expand Down
8 changes: 6 additions & 2 deletions scrapydweb/views/operations/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ def set_scrapy_cfg_list(self):
# Python 'ascii' codec can't decode byte
try:
self.scrapy_cfg_list = glob.glob(os.path.join(self.SCRAPY_PROJECTS_DIR, '*', u'scrapy.cfg'))
if os.path.exists(os.path.join(self.SCRAPY_PROJECTS_DIR, u'scrapy.cfg')):
self.scrapy_cfg_list.append(os.path.join(self.SCRAPY_PROJECTS_DIR, u'scrapy.cfg'))
except UnicodeDecodeError:
if PY2:
for name in os.listdir(os.path.join(self.SCRAPY_PROJECTS_DIR, u'')):
Expand Down Expand Up @@ -306,8 +308,10 @@ def handle_local_project(self):

self.search_scrapy_cfg_path(project_path)
if not self.scrapy_cfg_path:
self.scrapy_cfg_not_found = True
return
self.search_scrapy_cfg_path(self.SCRAPY_PROJECTS_DIR)
if not self.scrapy_cfg_path:
self.scrapy_cfg_not_found = True
return

self.eggname = '%s_%s.egg' % (self.project, self.version)
self.eggpath = os.path.join(self.DEPLOY_PATH, self.eggname)
Expand Down