Giter Club home page Giter Club logo

elections_network's Introduction

Installation of required software (for Ubuntu and Mac OS):
    * sudo aptitude install python python-setuptools git
    * sudo easy_install pip

    * git clone git://github.com/sergkop/elections_network.git CODE_DIR
    * sudo pip install -r CODE_DIR/requirements.txt

Installation (for Windows):
    * setup Python 2.7, git и Django 1.3.1
    * install setuptools and pip (http://pypi.python.org/pypi/pip)

    * git clone git://github.com/sergkop/elections_network.git CODE_DIR
    * pip install -r CODE_DIR/requirements.txt

Running development server:
    * rename site_settings.py.example to site_settings.py and set proper settings values

    * python manage.py syncdb (agree to create superuser)
    * python manage.py migrate
    * python manage.py init_db

    * 'python manage.py runserver' to run server
    * project is accessible at http://127.0.0.1:8000, admin interface - http://127.0.0.1:8000/admin/

Common problems (Linux/Mac OS):
    * Django admin media files are not loaded - make sure /static/admin/* url points to .../django/contrib/admin/media/ folder
      in django code directory

Common problems (Windows):
    * If syncdb step fails with the error in Windows 7

            django.db.utils.DatabaseError: You must not use 8-bit bytestrings unless you use
            a text_factory that can interpret 8-bit bytestrings (like text_factory = str).
            It is highly recommended that you instead just switch your application to Unicode strings.

      it is caused by the presence of non-latin symbols in the name of windows user. This is a known
      problem with Python2.7 and the only known workaround is to user another account with English letters-only usernames.

    * When you login into admin interface (http://127.0.0.1:8000/admin/) it can happen, that
      media files haven't loaded (interface looks ugly). Try accessing http://127.0.0.1:8000/static/css/screen/content.css),
      if it shows an error

            UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 0: ordinal not in range(128)

       In this case you need to run regedit, find "HKEY_CLASSES_ROOT\MIME\Database\Content Type" entry
       and remove all MIMETYPES with non-latin symbols in the name (it must be only "аудио/..." and "видео/...")

General advice:
    * Database is stored in database.sqlite, which you can always delete it and re-run 
      'python manage.py syncdb', 'python manage.py init_db' if something goes wrong.

Testing:
    * Run 'python manage.py init_test_data' to load database with users, links and contacts created for test purposes

Build a graph of database structure (requires graphviz and pygraphviz):
    * python manage.py graph_models -g geography links navigation users loginza auth -o docs/db_structure.png

-------- Optionally create virtualenv -------
* sudo pip install virtualenv
* virtualenv --no-site-packages VIRTUAL_ENV_DIR
* 'source VIRTUAL_ENV_DIR/bin/activate' (if installed must be run every time before running django server or set VIRTUALENV in site_settings.py)

Deployment:

    * install postfix (smtp client)

    * Configure vkontakte comments, remove {autoPublish: 0} option of vkontakte comments in templates/location.html in production
    * configure yandex.metrika
    * configure Google Analytics
    * set debug=False in site_settings.py on production
    * configure django logging

elections_network's People

Contributors

grishick avatar sergkop avatar shisoik avatar zhenya-kogan avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.