Skip to content

This website application will be a resource for students to study subjects in organic chemistry in conjunction to learning in class. This is in affiliation with Professor Ron Ramsubhag from Harvard University.

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md

jfairf01/OrgoWebsite

Repository files navigation

Website Template

A Postgres-Flask-Jinja application template with the boilerplate code already done for you.

Installing Dependencies

Check if you have the proper installations - you will need the following in some version;

$ python -V
  	Python 2.7.13
$ ruby
	(No warning will show up, so hit Ctl-c to exit)
$ redis-server
	(I didn't figure out config file so there's a warning but it works I think)
$ sass
	(Same thing as ruby)
$ postgres (don't type this)
	You will either type 'psql' or run it from the start programs to get a postgres server up and running.

If you don't have one of the above, you must download it and create an environment path (Windows) or Homebrew install it (Mac)

Setting up

Clone the repo
$ git clone git@github.com:jfairf01/TemplateWebsite.git
$ cd TemplateWebsite
Initialize a virtualenv
$ pip install virtualenv
$ virtualenv -p /path/to/python3.x/python.exe env
$ source env/bin/activate (this is optional in windows)

For mac users it will most likely be

$ pip install virtualenv
$ virtualenv -p python3 env
$ source env/bin/activate

Note: if you are using a python2.x version, point the -p value towards your python2.x path

Add Environment Variables

Create a file called config.env that contains environment variables in the following syntax: ENVIRONMENT_VARIABLE=value. For example, the mailing environment variables can be set as the following. We recommend using Sendgrid for a mailing SMTP server. But anything else will work as well.

MAIL_USERNAME=SendgridUsername
MAIL_PASSWORD=SendgridPassword
SECRET_KEY=SuperRandomStringToBeUsedForEncryption

Other Key value pairs:

  • ADMIN_EMAIL: set to the default email for your first admin account (default is flask-base-admin@example.com)
  • ADMIN_PASSWORD: set to the default password for your first admin account (default is password)
  • DATABASE_URL: set to a postgresql database url (default is data-dev.sqlite) (url = postgrespostgresql://user:password@localhost/location)
  • REDISTOGO_URL: set to Redis To Go URL or any redis server url (default is http://localhost:6379)
  • RAYGUN_APIKEY: api key for raygun (default is None)
  • FLASK_CONFIG: can be development, production, default, heroku, unix, or testing. Most of the time you will use development or production.

Note: do not include the config.env file in any commits. This should remain private.

Install the application's dependencies
$ pip install -r requirements.txt
Other dependencies for running locally

You need Redis, and Sass. Chances are, these commands will work:

Sass:

$ gem install sass

Redis:

Mac (using homebrew):

$ brew install redis

Linux:

$ sudo apt-get install redis-server

You will also need to install PostgresQL

Mac (using homebrew):

brew install postgresql

Linux (based on this issue):

sudo apt-get install libpq-dev
Create the database
$ python manage.py recreate_db
Other setup (e.g. creating roles in database)
$ python manage.py setup_dev

Note that this will create an admin user with email and password specified by the ADMIN_EMAIL and ADMIN_PASSWORD config variables. If not specified, they are both flask-base-admin@example.com and password respectively.

[Optional] Add fake data to the database
$ python manage.py add_fake_data

Running the app

$ source env/bin/activate (optional for windows)
$ honcho start -f Local

For Windows users having issues with binding to a redis port locally, refer to this issue.

Formatting code

Before you submit changes to flask-base, you may want to autoformat your code with python manage.py format.

About

This website application will be a resource for students to study subjects in organic chemistry in conjunction to learning in class. This is in affiliation with Professor Ron Ramsubhag from Harvard University.

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published