Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

External Config #4

Open
jelling opened this issue Aug 28, 2016 · 7 comments
Open

External Config #4

jelling opened this issue Aug 28, 2016 · 7 comments

Comments

@jelling
Copy link

jelling commented Aug 28, 2016

I can't get the project to load the external config file but everything else works, including posting to my Slack channel.

My config is at ~/.aptfinder/config/private.py. I've also tried putting it at ~/.aptfinder/private.py

I'm running docker w/ this command:

docker run -d -e SLACK_TOKEN={mytoken} -v /Users/jelling/.aptfinder:/opt/wwc/apartment-finder/config dataquestio/apartment-finder

Any ideas? I see no problems when running docker in interactive mode.

@jelling
Copy link
Author

jelling commented Aug 28, 2016

Per the Readme, I did a "docker exec -it {YOUR_CONTAINER_ID} /bin/bash" into the container and verified that the config directory is reading from my host config directory and that private.py is visible.

I also compiled private.py to make certain there weren't any syntax errors in the file.

@finnergizer
Copy link

Your docker run command should point to the config directory not the project root directory.

So something like:

docker run -d -e SLACK_TOKEN={mytoken} -v /Users/jelling/.aptfinder/config:/opt/wwc/apartment-finder/config dataquestio/apartment-finder

@jelling
Copy link
Author

jelling commented Aug 29, 2016

Thanks for the response but /Users/jelling/.aptfinder is not the project root directory. I'm on OSX if I matters.

@finnergizer
Copy link

finnergizer commented Aug 29, 2016

What does cat /opt/wwc/logs/afinder.log show in the docker container?

@jelling
Copy link
Author

jelling commented Aug 29, 2016

The only thing in the log is a couple of these:
/usr/local/lib/python3.4/dist-packages/bs4/__init__.py:181: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser fo r this system ("html5lib"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a d ifferent parser and behave differently.

Since it scrapes properly with the default values I presume this is not a problem.

@jelling
Copy link
Author

jelling commented Aug 29, 2016

Is there a known good private.py I can reference?

Interestingly, a pycache file is created for my private.py when I run the program. This indicates to me it's being properly imported and compiled when I start the docker container.

@finnergizer
Copy link

This is what mine looks like, located under config/private.py and it seems to be working alright.

MIN_PRICE = 1000
MAX_PRICE = 1800
CRAIGSLIST_SITE = '<mycity>'
AREAS = [""] #important to have this if you are not selecting any areas
BOXES = {
    "centretown": [
        [<lat>,<long>],
        [<lat>, <long>]
    ]
}
NEIGHBORHOODS = []
MAX_TRANSIT_DIST = 2 # kilometers
TRANSIT_STATIONS = {}
CRAIGSLIST_HOUSING_SECTION = 'apa'
SLEEP_INTERVAL = 20 * 60 # 20 minutes
SLACK_CHANNEL = "#housing"
SLACK_TOKEN = "<my-token>"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants