Skip to content

Commit

Permalink
Fix conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasThoren committed Sep 12, 2016
2 parents a659d26 + e16eb64 commit 166d7e3
Show file tree
Hide file tree
Showing 116 changed files with 2,856 additions and 3,238 deletions.
10 changes: 10 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[run]
include =
scripts/*.py
tests/*.py
www/*.py

[report]
exclude_lines =
pragma: no cover
if __name__ == '__main__':
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ backups
data
logs
misc
realestate/static/pictures
www/static/pictures
tests/data
tests/misc

# Files
scripts/phantomjs
scripts/ngrok
scripts/wires

*.Python
*.txt
Expand All @@ -20,5 +21,3 @@ scripts/ngrok
*.bmml
*.csv
*.out

fabfile.py
26 changes: 5 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
language: python
sudo: false
python:
- '2.7'
- '3.5'
install:
- pip install -r requirements.txt
before_script:
- export PYTHONPATH=$PYTHONPATH:$(pwd)
script:
- mkdir logs
- touch logs/realestate.log
script:
- coverage run tests/test*.py
- nosetests tests --with-coverage
- tox
after_success:
- coveralls
deploy:
Expand All @@ -18,23 +17,8 @@ deploy:
secret_access_key:
secure: Dh/dAklShJFyeh8jMTMe05BM20r///zb66k6f1VbwN26OrbWV1V6p4Ue83N1jTpFvBFc2C/XTHi/r42jRJU5H+zlJBc3Rwsly7aqHPXxee207Zi3Kgo62cqaZSLV4mnNlineFAkdjM82OhV1TKnT843F5L6gaSPJJHVRtz5Vrbk=
bucket: lensnola
local-dir: realestate/static
local-dir: www/static
upload-dir: realestate
acl: public_read
on:
repo: TheLens/realestate
env:
global:
- secure: B43D3wsqZ/+a/1OA6T0Cqevr96bUs3iqqMilZNyiZnwjdu+j2qKQ0JFMhiaUDvnSW41xhkQR00Yi5q6G1rWJ95eM67k/hFVCabIo0nbqKgHVtTOvofV443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NWuEvXp2OGNF2x/n/AnxghneUO7gk=
38 changes: 36 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ This app scrapes the latest property sales in New Orleans, stores the records in
Every day, these two commands are run to scrape and then build, geocode, clean and publish the previous day's sales. These are summarized in `scripts/main.sh`, which is run on a cron job every night.

```bash
python realestate/lib/scrape.py
python scripts/scrape.py
python scripts/initialize.py
```

Occasionally, due to bugs or password expiration, you will need to scrape and build beyond the previous day. You can specify the date range for both commands by using command-line arguments.

```bash
# <starting_date> <ending_date>
python realestate/lib/scrape.py 2016-05-01 2016-05-05
python scripts/scrape.py 2016-05-01 2016-05-05
python scripts/initialize.py 2016-05-01 2016-05-05
```

Expand All @@ -53,3 +53,37 @@ export REAL_ESTATE_LRD_PASSWORD='MyLandRecordsDivisionPassword'
export REAL_ESTATE_DATABASE_USERNAME='MyDatabaseUsername'
export REAL_ESTATE_DATABASE_PASSWORD='MyDatabasePassword'
```

#### Tests

```bash
nosetests
```

```bash
tox
```

Run the app using Python 3. Set this up when creating the virtual environment. This is because OpenSSL/urllib3 has security flaws in older versions.

```bash
mkvirtualenv TODO realestate
```

Run `nosetests tests` in the app's top-level directory. To show code coverage as well, run `nosetests tests --with-coverage`.

__Different Python versions__

The app uses `tox` for testing different Python versions. The app is compatible and tested for Python 2.7 and 3.5. The basic usage:

```bash
tox
```

You may need to first run `unset PYTHONPATH`.

You can also run specific Python version tests like this:

```bash
tox -e py35
```
25 changes: 14 additions & 11 deletions confs/app.ini
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
[uwsgi]
master = true
workers = 2
harakiri = 60
max-requests = 100
socket = 127.0.0.1:5004

virtualenv = /home/ubuntu/.virtualenvs/realestate
chdir = /home/ubuntu/realestate
for-readline = /home/ubuntu/.virtualenvs/realestate/bin/postactivate
env = %(_)
endfor =
endfor =
for-readline = /home/ubuntu/.virtualenvs/postactivate
env = %(_)
endfor =
wsgi-file = realestate/app.py
endfor =
wsgi-file = www/app.py
callable = app
touch-reload = /home/ubuntu/realestate/realestate/app.py
socket = 127.0.0.1:5004
touch-reload = /home/ubuntu/realestate/www/app.py
logto = /var/log/uwsgi/realestate.log
log-maxsize = 10500000
uid = ubuntu
gid = ubuntu
die-on-term
catch-exceptions
workers = 2
harakiri = 120
max-requests = 200
master
die-on-term = true
catch-exceptions = true
vacuum = true
3 changes: 2 additions & 1 deletion confs/realestate.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
description "uWSGI instance to serve realestate app."

start on runlevel [2345]
stop on runlevel [!2345]

respawn

script
Expand Down
3 changes: 3 additions & 0 deletions crontab
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Real estate
*/5 * * * * cd /home/ubuntu/realestate && git fetch origin master && git reset --hard FETCH_HEAD # Sync with GitHub master branch
0 3 * * * /home/ubuntu/realestate/scripts/main.sh # Scrapes and builds yesterday's sales
16 changes: 16 additions & 0 deletions docs/contracts.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. _contracts:

Contracts
=========

.. automodule:: contracts.app
:members:

.. automodule:: contracts.db
:members:

.. automodule:: contracts.models
:members:

.. automodule:: contracts.views
:members:
20 changes: 10 additions & 10 deletions docs/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,32 @@ Misc.
.. automodule:: realestate.views
:members:

.. automodule:: realestate.lib.delete_dates
.. automodule:: scripts.delete_dates
:members:

.. automodule:: realestate.lib.email_template
.. automodule:: scripts.email_template
:members:

.. automodule:: realestate.lib.form_tweet
.. automodule:: scripts.form_tweet
:members:

.. automodule:: realestate.lib.get_dates
.. automodule:: scripts.get_dates
:members:

.. automodule:: realestate.lib.libraries
.. automodule:: scripts.libraries
:members:

.. automodule:: realestate.lib.mail
.. automodule:: scripts.mail
:members:

.. automodule:: realestate.lib.results_language
.. automodule:: scripts.results_language
:members:

.. automodule:: realestate.lib.stat_analysis
.. automodule:: scripts.stat_analysis
:members:

.. automodule:: realestate.lib.twitter
.. automodule:: scripts.twitter
:members:

.. automodule:: realestate.lib.utils
.. automodule:: scripts.utils
:members:
110 changes: 0 additions & 110 deletions realestate/lib/delete_dates.py

This file was deleted.

0 comments on commit 166d7e3

Please sign in to comment.