This is the official Mozilla India site based on Mozilla's Playdoh.
Clone the github repo and get all the Python dependencies:
$ git clone https://github.com/MozillaIndia/mozindia.git
$ cd mozindia
$ git submodule update --init
$ cd vendor
$ git submodule sync
$ git submodule update --init
$ cd ..
$ mv mozindia/settings/local.py{-dist,}
The settings file for your local development is mozindia/settings/local.py
.
Edit it and change the DATABASES
setting. Change the NAME
to, say,
'mozindia'
and add your MySQL user/password in the right place if needed.
Note: Never commit this file mozindia/settings/local.py
. It is meant
for your local development only.
Now you need to actually create a database. Do
$ mysql -u root -p
If you have a password for the MySQL root user(not the UNIX root), else just:
$ mysql -u root
At the mysql prompt, type this if you want to create a MySQL user:
mysql> create user 'mozindia'@'localhost' identified by 'password_here';
Note: Please make sure the user/password you created here is the same as the one present in the settings(local.py) file discussed in the previous section.
Then assuming both the username and database name are called 'mozindia',
mysql> create database mozindia;
mysql> grant all on mozindia.* to 'mozindia'@'localhost';
mysql> quit;
Now install virtualenv if you do not have it:
$ aptitude install python-virtualenv virtualenvwrapper
Create a virtualenv to work on:
$ mkvirtualenv mozindia
Don't break your head over what a virtualenv is - just know that it is a self contained environment for a Python project. Your prompt should now indicate what virtualenv you are working on:
(mozindia)$
You can come out of it by typing
(mozindia)$ deactivate
$
And go back to work by typing
$ workon mozindia
(mozindia)$
Now install the Mozilla funfactory package:
(mozindia)$ pip install funfactory
Note: If you do not have pip
installed, it can be installed(on Debian)
like so:
$ aptitude install python-pip
If you run Fedora, chances are your pip will be called python-pip
, so you
will have to run
(mozindia)$ python-pip install funfactory
on Fedora.
Next up, we need to install some compiled dependencies in the virtualenv we just created. So run (from the root mozindia directory)
(mozindia)$ pip install -r requirements/compiled.txt
The output of this command, when it finishes, should end with something like
Successfully installed MySQL-python Jinja2 py-bcrypt
Cleaning up...
(mozindia)$
We need to create the tables used by mozindia on the database we created sometime ago:
(mozindia)$ python manage.py syncdb
This will ask you to create a superuser for the Django admin. Create one now( just follow the prompts).
Finally, we can now run the mozindia site locally:
(mozindia)$ python manage.py runserver
Validating models...
0 errors found
Django version 1.4.5, using settings 'mozindia.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
You can now go to localhost:8000
in the browser to see the site.
Patches are welcome! Fork this repo, perform the exact above steps with the repo URL changed to the URL of your fork, hack and send an awesome pull request.
If you have already cloned this repo and have successfully run mozindia locally, then save some bandwidth by
- Forking the repo on github
- Running the following commands(change the
username
bit to your Github username)
$ git remote rename origin upstream
$ git remote add origin https://github.com/username/mozindia.git
Now all the pushes to origin will be to your fork, and you can pull all the changes upstream by
$ git fetch upstream
Mozindia is proudly a Playdoh project. Refer to the Playdoh docs here.
Discussions can take place in the Mozilla India mailing list(join)
and on IRC(#india
@irc.mozilla.org).
Happy hacking!
This software is licensed under the New BSD License. For more
information, read the file LICENSE
.