WebApp for storing and managing ip addresses, lists and ip sources.
To participate in development you'll need to make some configuration and install certain programs and libraries.
We will be using this stuff:
- Django - You probably already know what it is.
- MySQL-python - Nice MySQL database connector for Python
- SQLAlchemy - Famous database toolkit for Python, we will use it's database pooling features
- netaddr - A pure Python network address representation and manipulation library
- django-debug-toolbar - Displaying various debug information about the current request/response)
- pygeoip - Pure Python API for Maxmind's binary GeoIP databases.
- django-recaptcha - Django reCAPTCHA form field/widget integration app.
- python-daemon - Python library to implement a well-behaved Unix daemon process.
- django-dajaxice - Easy to use AJAX library for django.
- django-dajax - Easy to use library to create asynchronous presentation logic with django and dajaxice.
So lets begin!
First off you'll need to clone this repo:
SSH: git clone git@github.com:andriykohut/LV-090_LAMP.git
HTTPS: git clone https://github.com/andriykohut/LV-090_LAMP.git
We will install python libraries using pip
- a nice tool for installing and managing python packages. We need to install some dependencies for building mysqldb
too (since pip builds all libraries from sources), on Ubuntu that's easy:
sudo apt-get install libmysqld-dev python-dev python-pip
Now we're ready to setup our libraries, just cd
to cloned repo directory and execute this command, it will install all necessary libs:
sudo pip install -r requirements.txt
To use our project easily we need to add src/python
to PYTHONPATH
environmental variable, cd
to src/python
execute pwd
to see absolute path to project (should look like this /home/user/LV-090_LAMP/src/python
), then execute following command:
export PYTHONPATH=$PYTHONPATH:/home/user/LV-090_LAMP/src/python
This is just an example, you should use your absolute path. However this settings won't last, to keep them permanent you'll need to add them to your .bashrc
or .zshrc
shell profile. These files can be found at your home directory. You can edit them like this:
cd ~/ && nano .bashrc
Append whole export PYTHONPATH
command to the end of yout shell profile file. Now you shuold be able to use package imports from project without relative imports or other heresy.
Now, we'll need to create a database for our project, cd
to project's bin
directory and execute ./create_database.sh
(in script replace root
with your mysql admin user and make shure that database with name ip_addresses
doesn't exist)
This will create all tables for our database.
Then go to project's etc
directory and make your config files from examples:
cp dbapi.cfg.example dbapi.cfg
cp logging.cfg.example logging.cfg
Open dbapi.cfg
file and input yor user settings for mysql server (user
and password
should be enough).
The last but not least is django local_settings.py
config. Example can be found in web/ipconflux/ipconflux
directory.
Modify it to your preferences and save as as local_settings.py
:
cp web/ipconflux/ipconflux/local_settings.py.example web/ipconflux/ipconflux/local_settings.py
You'll need to set USER
and PASSWORD
in DATABASES
dictationary. Thats your database admin. Then specify path for static files directory (where css, js, etc. is stored), it should be your project absulute path + web/ipconflux/static
directory. Change templates directory in TEMPLATE_DIRS
variable /home/user/ipconflux/web/ipconflux/templates
. Then add SECRET_KEY
- you should have it already.
Also add your RECAPTCHA_PUBLIC_KEY
and RECAPTCHA_PRIVATE_KEY
there.
To compile localization messages you'll need to run django-admin.py compilemessages
in web/ipconflux
directory.
Set path to directory with dictionaries: in local_settings.py
change variable LOCALE_PATHS
.
That's all, now you can run python manage.py syncdb
and enjoy development...