CityOfNewYork / DORIS-Publications-Portal

DORIS Publications Portal
3 stars 6 forks source link

Government Publications Portal

The Unholy Union of Alan Chen's Government Publications Sumissions Portal WIP and the Government Publications Portal developed in the Summer of 2014.

Flask + React & Redux, using the JSend specification and the Semantic-UI framework

Development Process Notes

Customizing CSS Theme

Should Semantic-UI vanilla styles become too bland, check this out.

Redux Usage

How To: Forms

Part 1 - BE

Part 2 - FE

Development Environment Setup

  1. Make sure you have VirtualBox version 5.1.18.

    • If you have a later version and initial setup fails, please install 5.1.18 and retry.
    • You can upgrade to the latest version and vagrant reload after your setup is complete.
  2. Copy / Development Tools / Vagrant Boxes /rhel-6.8.virtualbox.box from smb://csc.nycnet/doris/doris_share/development into your project root or any desired directory.

    • You may need to supply your CSC credentials.
  3. Run ./setup.sh from within your project root directory.

    • This script will attempt to:

      • Add the rhel-6.8-5.1.18 vagrant box
      • Install the vagrant plugins vagrant-reload, vagrant-vbguest, and vagrant-triggers
      • Copy Vagrantfile.example into Vagrantfile
      • Prompt you for your RedHat Developer Account credentials
        • If you do not have a developer account, create one.
      • Build your development VM
    • If you experience build errors, try re-provisioning (at most once):

      RH_USER=<Your RedHat Username> RH_PASS=<Your Redhat Password> vagrant provision
    • If you do not want to set the RH_ environment variables and you don't mind having your RedHat credentials stored in your Vagrantfile, you can add them on lines 4 and 5.

  4. Run vagrant ssh to connect to your development environment.

  5. Run python manage.py runserver to start the app. You can access it on your browser at https://10.0.0.2

    • You can also run python manage.py runserver -host 0.0.0.0 to access the app at localhost:8000

You can stop here if you're only doing backend development. Otherwise, you will need to do the following:

  1. In the settings of your preferred project editor, set the Tab Size and Indent to 2. If you are using PyCharm (2016.3), these settings can be found in Preferences > Editor > Code Styles.

  2. Install npm (or yarn)

    OS X: brew install npm

    RedHat: sudo yum -y install rh-nodejs4; scl enable rh-nodejs4 bash

    • It might be a good idea to make an alias for that second command as you will need to execute it before running any npm command: alias enable_node="scl enable rh-nodejs4 bash"
  3. Navigate to gpp/ and run npm install

  4. Run npm start

    • The application that has been started is the only one you need to access via browser (see table below) in order to test any changes. The Flask app will serve as your backend so make sure that is running as well!
Environment Browser Address package.json proxy hot reload?
Local http://localhost:4000 http://localhost:8000 Yes
Vagrant http://localhost:5000 http://localhost:5000 No :(