- Enter the project root folder
cd <project root>
- Install homebrew
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)”
- Install python
brew install python
3.5
pip install virtualenv
pip install virtualenvwrapper # might not be necessary
Add this to your bash_profile:
export WORKON_HOME=$HOME/.virtualenvs
source "/usr/local/bin/virtualenvwrapper.sh"
- Create a virtual environment
mkvirtualenv search
- Switch to that virtual environment (not necessary if you just created the virtualenv)
workon search
- Install the requirements
pip install -r requirements.txt
- Install postgres git push --set-upstream origin postgres
brew install postgresql
Then run postgres with the command
postgres
You may need to add
export PGDATA="/usr/local/var/postgres"
to your ~/.bash_profile And type this into your shell
createdb
-
Create your postgres database To do this, run psql, then type the SQL command CREATE DATABASE postgres; CREATE DATABASE search; Then quit psql with \q This database should really be called "search" and not "postgres". This is a bug.
-
Sync the database
./manage.py syncdb
If you choose not to create a superuser when prompted you can create one later with
./manage.py createsuperuser
- Run the server
./manage.py runserver
You should get something like
System check identified 4 issues (0 silenced).
November 28, 2014 - 12:27:37
Django version 1.7.1, using settings 'search.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
- Now open up a web browser and go to http://127.0.0.1:8000/. This should bring you to the search engine homepage.
Three commands are necessary to run the server properly
To run the postgres database, call
postgres
This does not require you to be in your virtual environment.
To run the web interface run
./manage.py runserver
This requires you to be in your virtual environment.
To run the crawler, run
./manage.py auto_crawl
This requires you to be in your virtual environment.
To run all unit tests ./manage.py test
To run flake8 tox
To manually crawl a url ./manage.py crawl_url_subdomains http://website.com/
To create a superuser ./manage.py createsuperuser
To mess with the PostgreSQL database (Help is "?") psql
Whenever you modify a model you will need to create a migration using ./manage.py makemigrations
Then everyone with a database will need to run manually ./manage.py migrate
If the database doesn't work, try running
./manage.py syncdb
This could be caused whenever anyone commits a change to the underlying models