Skip to content

Doing uber code challenge to learn basic technique for internship

Notifications You must be signed in to change notification settings

zwang180/uber_challenge_test

Repository files navigation

Uber Challenge Test

Doing uber code challenge (SF Film Locations) to learn basic technique for internship. The website can be view at https://sffilm.herokuapp.com/ and the database is holding on mLab.

Setup Environment

All of the following tutorials are designed for Mac OS, for other platform, please refer to official documents for guidance.

Assuming you already have python(2.7), pip and homebrew installed on your computer. If any of the following commands fail to run, add sudo at the very beginning and try again. If it still doesn't work, please refer to official documentations.

  1. Install Django

Inside your terminal do

pip install django
  1. Install MongoDB

Inside your terminal do

brew update
brew install mongodb
  1. Install dependencies

You will need three python packages: PyMongo, MongoEngine and Requests, do it by command

pip install pymongo
pip install requests
pip install mongoengine
  1. Get source code

Navigate to your desire directory in your terminal and do

git clone https://github.com/zwang180/uber_challenge_test.git

Then make sure you have the latest version by

git fetch
git pull
  1. Start the server and the database

First start the database server, in terminal(assume the path of the source code, i.e. the directory containing manage.py is /some/path/to/source/), do

mongod --dbpath /some/path/to/source/film/data/

Next, if this is the first time you run the code, dump the data to your local database by running loadData.py(if you just want to query the data) or run loadDataToModels.py(if you would like to work with Film model)

python loadData.py
python loadDataToModels.py

Please make sure your MongoDB server is running while you run the above command

Finally, run Django server in another terminal window/tab

python manage.py runserver

Then the website is ready to view at http://localhost:8000/ (by default)

Other issues

The FastSetup_Uber.scpt is an AppleScript that could start both servers in two seperate terminal tabs and also open the third tab in order to give you a free tab to do git commands or dump data. There is also an App version of the script. So if you are using Mac OS(Scirpt was written in El Captain), you could modify the file path in the script and make use of it.

To Do Next

  1. Major Change

More cool features such as google map API. 2. Minor and Performance Change

2.1 Add static files(especially CSS and Javascript) to beautify the website. !IMPORTANT!

2.2 Implement more general search function(ignore space, case insensitive, search by other field) by regex and other tools.

2.3 Figure out how to create superuser. (wait for mongoengine to update for Django 1.9 hopefully, see https://github.com/MongoEngine/django-mongoengine).

P.S: mongoengine==0.9.0 && pymongo==2.8.1 && proper settings https://mongoengine.readthedocs.io/en/v0.9.0/django.html

result in sucess for creating superuser but failure when login to admin site.

About

Doing uber code challenge to learn basic technique for internship

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published