Coder Social home page Coder Social logo

analysocial's Introduction

analysocial

Django app for Analysocial https://analysocial.herokuapp.com/

Development

Fork the project on github and git clone your fork, e.g.:

git clone https://bitbucket.com/<username>/analysocial.git

Create a virtualenv using Python 3 and install dependencies. I recommend getting python3 via homebrew, then installing virtualenv and virtualenvwrapper to that python. NOTE! You must change 'path/to/python3' to be the actual path to python3 on your system.

mkvirtualenv analysocial --python=/path/to/python3
pip install -r requirements.txt

You may want to set up an alias for making python3 virtualenvs, e.g. in .bashrc:

 alias mkvirtualenv3='mkvirtualenv --python=/usr/local/bin/python3'

Ensure node is installed. This can be done via homebrew:

brew install node

Install javascript dependencies:

npm install

Set environment variables as needed. I recommend putting the exports at the end of your ~/.virtualenvs/analysocial/bin/activate so they are always available when in your virtualenv. You need to substitute appropriate values for all <CONFIGURABLE_ITEMS>.

export DJANGO_SETTINGS_MODULE=analysocial.settings
export DJANGO_ENABLE_SSL=0
export DJANGO_DEBUG=1
export DATABASE_URL=postgres://<YOUR_USER_NAME>:<YOUR_PASSWORD>@localhost:5432/analysocial
export ADMINS='{"admins": [{"name": "<YOUR_NAME>", "email": "<YOUR_EMAIL>"}]}'

Set up db:

createdb analysocial
python manage.py migrate

Run unit tests and view coverage:

coverage run manage.py test
coverage report -m

Speed up unit tests by setting environment variable:

export REUSE_DB=1

Check code style:

flake8 .

To generate a graph of the data models, you can use the following management command:

python manage.py graph_models --pygraphviz -a -g -o all_models.png

Lint JavaScript:

jshint */static/*/js

Run the development server:

python manage.py runserver

Deployment

This project is already set up for deployment to Heroku, on the app analysocial.

The Heroku apps have the following addons:

heroku addons:create heroku-postgresql
heroku addons:create sendgrid
heroku addons:create newrelic
heroku addons:create papertrail
heroku addons:create scheduler

Set the Heroku config vars:

ADMINS

Add Heroku buildpacks:

heroku buildpacks:set heroku/nodejs -i 1
heroku buildpacks:set heroku/python -i 2

To deploy directly to Heroku (right now, this is the only way to update static, etc.):

sh scripts/deploy_to_heroku.sh

To push a specific branch to Heroku:

git push -f heroku <local-branch>:refs/heads/master

TODO

  • Add view of top 10 posts
  • Analyze words in posts
  • Sorting on posts view page
  • CSV download from site
  • Sync historical posts for new users (use RQ?)
  • Email admin when new user signs up

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.