Note: This is a debugging branch and should NOT be merged with the master until and unless the code is updated and stable.
To use this project, we will work though the following steps:
- Install requirements
- Clone this repo
- Create a
virtualenvin the project root folder - Have a local instance of
postgresrunning - Install ngrok
- Code away
We strongly suggest on using virtualenv for python development.
On mac osx
# On Mac OSX we suggest homebrew, also known as brew
# please visit https://brew.sh/
# follow the on-screen instructions of the website
# hopefully homebrew is installed
# let us now use brew to install python3
brew install python3On windows
# On windows we suggest chocolatey, also known as choco
# please visit https://chocolatey.org/
# follow the on-screen instructions of the website
# let us now use choco to install python3
choco install python --version 3.6.3We now will setup an environment to run the python code of the https://gitlab.com/bikespace/Bicycle-parking project setup on your computer
make setupSupplied with the repo is a docker-compose.yml file to get a postgres instance up and running with the
postgis extension. The postgis extension is needed for the spatial data we use in the application.
For first time setup it requires a little bit of time in the terminal, so hang in there but once setup it will be smooth for the rest of the development process.
Install docker and docker-compose for your OS.
For Mac and Windows if you install docker, docker-compose is already installed so don't have to worry about that.
Supplied is a docker-compose.yml file for spinning up a containerized postgres with the necessary spatial
files loaded already. Feel free to look around in the db folder for all the container startup files.
# To run the docker container of our postgres image
docker-compose -f docker-compose.yml up -d --build
# If all is successfully monitor the logs for first time setup
docker-compose logs -fNote: Windows users might need to open some files in vim and set the fileformat to unix
:set fileformat=unixOnce all the spatial tables are loaded then the container db instance is ready to go.
Keep in mind the port it is running on, in order to not conflict with any other postgres instance you might have
running we bind host post to 5435 so that is the port where the postgres instance will be running.
To create test data to work on, for moderation or other purposes, run the test transaction script:
make seedOpen your 5435 port it might be closed by default because of the firewall
#open 5435 code
sudo ufw allow from 127.0.0.1/24 to any port 5435Once all the above steps are complete test by running the django app.
make startWhenever the models.py for the app has been changed, the
changes can be applied to the databases by running:
make migrateSee our contributing guidelines
ngrok is needed to serve the local django application over ssl. To install ngrok, use npm.
Install ngrok globally:
We can use npm or yarn.
which npm
npm install ngrok -gWe are using Webpack to bundle the js for the client side. To compile cd into the bicycleparking and run :
npm run localFor hot-reloading setup a watcher:
npm run $ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
$ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
$ sudo apt-get update && sudo apt-get install yarn
$ sudo yarn global add ngrok
In the main project directory:
$ yarn postinstall
For hot-reloading:
In the bicycleparking directory
$ yarn run watch
# Now run ngrok to serve over https
# ngrok http [please_insert_port_django_is_running_on]
# for example
ngrok http 3000
This is the current project structure, please note:
- the
Bicycle_parkingis the main Django Project folder - the
bicycleparkingdir is one of the apps for the project
├── bicycleparking
│ ├── admin.py
│ ├── apps.py
│ ├── geocode.py
│ ├── __init__.py
│ ├── intersection.py
│ ├── migrations
│ ├── models.py
│ ├── node_modules
│ ├── package.json
│ ├── __pycache__
│ ├── Routers.py
│ ├── serializers.py
│ ├── static
│ ├── templates
│ ├── tests.py
│ ├── uploader.py
│ ├── urls.py
│ └── views.py
├── Bicycle_parking
│ ├── __init__.py
│ ├── __pycache__
│ ├── settings
│ ├── static
│ ├── urls.py
│ └── wsgi.py
├── CONTRIBUTING.md
├── db.sqlite3
├── docker-compose.yml
├── HTML_CSS
│ ├── background_images
│ ├── files_old
│ ├── flatpickr.css
│ ├── happening.html
│ ├── icons
│ ├── index.html
│ ├── issue.html
│ ├── map.html
│ ├── mobilesheet.css
│ ├── Open_Sans
│ ├── picture.html
│ ├── stylesheet2.css
│ ├── stylesheet.css
│ ├── success.html
│ └── summary.html
├── LICENSE
├── manage.py
├── mkaddressdb
├── mkintersectiondb
├── node_modules
│ ├── flatpickr
│ ├── leaflet
│ └── leaflet-search
├── package.json
├── package-lock.json
├── Procfile
├── README.md
├── requirements.txt
├── runtime.txt
├── sql
│ ├── intersec2d.sql
│ ├── intersection_types.sql
│ ├── makegisdb.sql
│ └── visit_address.sql
├── test
│ ├── areas.xml
│ ├── geodata_001.xml
│ ├── intersection_test.cpg
│ ├── intersection_test.dbf
│ ├── intersection_test.prj
│ ├── intersection_test.shp
│ ├── intersection_test.shx
│ ├── makeAreas.py
│ ├── removeTestDB.py
│ ├── test_data.sql
│ ├── useaws
│ └── useci
└── venv
├── bin
├── include
├── lib
├── pip-selfcheck.json
└── share
please see the LICENSE file
generated using https://choosealicense.com/licenses/mit/