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
The following directories and files in app/
should not be altered manually:
templates/
static/
asset-manifest.json
favicon.ico
package.json
Changes made during frontend development should only affect the gpp/
directory.
In order to run the Government Publications Portal without having to launch the React app
(i.e. Flask only), run ./build.sh
.
npm run build
--and will transfer it to app/
.master
should always be in a production-ready state, build.sh
should
be executed before pushing to the branch whenever any frontend changes are made.SQLAlchemy query code should be restricted to the app/database/
directory.
app.database.user.User
class and that method
will be called to perform the retrieval.Expected console warnings (as of 4/10/17):
Accessing PropTypes via the main React package is deprecated...
React.PropTypes
MaskedInput: React.createClass is deprecated...
React.createClass
Should Semantic-UI vanilla styles become too bland, check this out.
authenticated
.app/schemas
for examples.validate_json
in app/resources/lib.py
.
"date": {
"pattern": "\\d{2}/\\d{2}/\\d{4}",
"type": "string",
"error": { // not spec-compliant
"pattern": "This is not a valid date value."
}
}
withValidation
,
is provided in gpp/src/custom.js
to aid the form creation process. It handles the collection, updating, and
submission of form data and will populate its state's error
property if there are issues during submission or
if the server responds with any errors.Make sure you have VirtualBox version 5.1.18.
vagrant reload
after your setup is complete.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.
Run ./setup.sh
from within your project root directory.
This script will attempt to:
Vagrantfile.example
into Vagrantfile
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.
Run vagrant ssh
to connect to your development environment.
Run python manage.py runserver
to start the app.
You can access it on your browser at https://10.0.0.2
python manage.py runserver -host 0.0.0.0
to access the app at localhost:8000
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
.
Install npm (or yarn)
OS X: brew install npm
RedHat: sudo yum -y install rh-nodejs4; scl enable rh-nodejs4 bash
alias enable_node="scl enable rh-nodejs4 bash"
Navigate to gpp/
and run npm install
Run npm start
Environment | Browser Address | package.json proxy |
hot reload? |
---|---|---|---|
Local | http://localhost:4000 | http://localhost:8000 | Yes |
Vagrant | http://localhost:5000 | http://localhost:5000 | No :( |