Home - sigurdga/Smart113 GitHub Wiki
Different kinds of instructions will appear here.
Development instructions
Installation requirements
Obviously you will need Git and Python. Installation is up to your operating system. Only windows users would need to download and install from web. Linux and Mac users have code repositories containing recent versions.
In addition to Python, you need PIP, the Python package installer (for Python modules). The site has a bit of documentation and you should find the installation instructions. Again, PIP is also easily installable through the operating package repositories. In APT, the package you need is called python-pip
.
To run, you also need a development database, and this project is set up to use Sqlite during development. Make sure you have sqlite3 installed. The package name in the repositories should be something like sqlite3.
Now, for the more relevant stuff:
git clone [email protected]:sigurdga/Smart113.git
where you want to install to. You should add SSH keys to your Github settings so you do not need to type a password all the time. If you are not logged in on Github, you will not see this clone link in the top of the code pages, you can still clone using the other links, but you will not be able to push back to Github (which is necessary to collaborate).pip install virtualenv
will make it easy to create virtual environments, so this package's dependencies will not interfere with other development or the operating system's dependencies. You can likely use thepython-virtualenv
from your operating system's packages as well. (optional)- Go into your new directory/folder (still through command line) and run
virtualenv --no-site-packages --distribute .
(yes it is a dot, and it is necessary, at least the way I am doing it). (optional) - Activate your virtualenv with
source bin/activate
(at least this is the command on Linux/Mac) (optional)
Project dependencies
- Find the project's requirements.txt, which is where the project dependencies are, and run
pip install -r requirements.txt
. (If you skipped the optional steps above, you may need super user privileges to do this.) - Running
python manage.py sync --migrate
will create a local database for you, at the newest version. It will also ask you to setup an account which can be used to log in.
Run the development server
Run python manage.py runserver
and head over to your favourite browser and look at localhost:8000
.
There are two ways to log in as a user. One using the login at the main page, but that will not work with the account you recently created. To use that instead, be sure you are logged out of the federated? account and head over to localhost:8000/admin
to log in using your administration account. I prefer using the admin account during development as it is allowed to do everything. But it is not too hard to upgrade a federated account with full privileges.
What to do next?
Code changes
Try changing the forms.py inside smart113/core by adding removing fields. The fields are defined in models.py of the same directory. You can also move stuff around in models.py, as the position inside that file does not change how the program runs.
In models.py, do not change the variable names (the part before the =) as that will break both forms.py and the templates. Remember that the labels you see in forms are taken from the _() parts you will see all over models.py, and these are easy to change. You can try adding new fields at will. Instead of removing fields, you could remove the references to them from forms.py and the templates, and you will not see it again.
Template changes
The templates are located in smart113/templates. These are HTML files with some logic. Should not be too hard to understand most of them.
Translations
The strings inside _() in the python files and inside trans and blocktrans in the templates will be translatable. We will soon enable translating through a web service to make it easy to translate, knowing that translation is not too useful as the code is a moving target for quite some time.