Skip to content

Allow configuration of base directory - #532

Closed
prevostc wants to merge 4 commits into
codelucas:masterfrom
matterstech:master
Closed

Allow configuration of base directory#532
prevostc wants to merge 4 commits into
codelucas:masterfrom
matterstech:master

Conversation

@prevostc

@prevostc prevostc commented Mar 15, 2018

Copy link
Copy Markdown

I was able to make newspaper work on aws lambda with this PR update and the following code

# only /tmp is writable on lambda env
os.environ['NEWSPAPER_BASE_DIRECTORY'] = '/tmp'
os.environ['NLTK_DATA'] = '/tmp'

# https://stackoverflow.com/a/44532317/2523414
# no sqlite in lambda, needed by a small subset of nltk
import imp
import sys
sys.modules["sqlite"] = imp.new_module("sqlite")
sys.modules["sqlite3.dbapi2"] = imp.new_module("sqlite.dbapi2")

from newspaper import Article
import nltk
nltk.download('punkt')

This PR is also handy for AWS Beanstalk as the /home/wsgi folder do not exists and you also need to configure the directory

@codelucas

Copy link
Copy Markdown
Owner

Great idea, thanks for implementing this @prevostc. Will take a look / test and likely merge in a few days! 👍 💯

@torbenbrodt

Copy link
Copy Markdown
Contributor

+1

@prevostc

prevostc commented Aug 1, 2019

Copy link
Copy Markdown
Author

This PR is now 1.5 year old, which is a billion serverless years. I'm closing it :)

@prevostc prevostc closed this Aug 1, 2019
@mkilp

mkilp commented Oct 24, 2019

Copy link
Copy Markdown

Why did this not get merged? This is really needed in my opinion.

@vchalana1

Copy link
Copy Markdown

Hello, Is this change in the 0.2.8 release? I did a pip install of the latest release as of March 2, 2020, and I don't see any NEWSPAPER_BASE_DIRECTORY.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants