If you are trying to use the i18n functionality of Django, and nothing is happening when you switch language, make sure that your translated files are not in my_django_project/conf/locale/ but in my_django_project/locale/
Martin
Ok now that SVN(Subversion) is installed, we need to decide in which folder you want to have your files saved. SVN is like a database of your files.sudo apt-get install subversion
sudo svnadmin create /home/svnNow that this is done, you can run ls -l /home/svn to doublecheck that the folder has been created correctly.
mkdir /tmp/martincozzi/trunkWhy /tmp ? Because i am just building a architecture for my SVN and I don't really need these folders after ! To import these files into my SVN repository I type :
mkdir /tmp/martincozzi/tags
mkdir /tmp/martincozzi/branches
sudo svn import /tmp/martincozzi/ file:///home/svn/martincozzi/ -m "Folder Hierarchy Creation"The -m option stands for Message. I am just leaving a message for myself later on saying "This is when I created my file hierarchy".
sudo svn import /home/code/martincozzi/ file:///home/svn/martincozzi/trunk -m "Importing website into SVN"Great ! My website is now into the SVN ! What does this mean ? Wherever I am, I can now get the latest version of my project and work on it !
mkdir /home/martin/code/dev/To checkout my project into /dev I do the following :
mkdir /home/martin/code/prod/
svn checkout file:///home/svn/martincozzi/trunk /home/martin/code/dev/martincozziBy doing this I get the last version of my project, ready to worked on ! Every change that I make will on this files will be recorded by SVN !
svn diffSVN will tell you which files have been edited.
svn commit -m "Here is a list of changes that I've made : bla bla bla bla "My changes have been submitted to SVN. I am now ready to show the public the changes that I've made to my webiste. In order to do that, I want it to be published inside /home/martin/code/pub/martincozzi/ . To do so, I will use the export command from svn.
svn export file:///home/svn/martincozzi/trunk/ /home/martin/code/prod/martincozzi/And I now have the last version of my website in my prod/ folder ! I can now setup Apache to have two addresses, like :
<VirtualHost *>And for the dev part :
ServerAdmin admin_contact@martincozzi.com
DocumentRoot /home/martin/code/prod/martincozzi/
ServerName martincozzi.com
ServerAlias www.martincozzi.com
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE martincozzi.settings
PythonDebug Off
PythonPath "['/home/martin/code/prod/'] + sys.path"
</Location>
</VirtualHost>
<VirtualHost *>Easy isn't it ?!
ServerAdmin admin_contact@martincozzi.com
DocumentRoot /home/martin/code/dev/martincozzi/
ServerName dev.martincozzi.com
ServerAlias dev.martincozzi.com
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE martincozzi.settings
PythonDebug Off
PythonPath "['/home/martin/code/dev/'] + sys.path"
</Location>
</VirtualHost>
cp /home/martin/code/dev/martincozzi/settings.py /home/martin/code/dev/martincozzi/local_settings.pylocal_settings.py is going to be my config file for /dev/ whereas settings.py is going to be my /prod/ settings file.
DEBUG = TrueAnd in settings.py change it to :
DEBUG = FalseAnd of course change your MEDIA_ROOT and TEMPLATE_DIRS according to your templates info, with /prod/ for settings.py, and /dev/ for local_settings.py
try:This tries to load the local_settings.py infos, and if it can't then just use the settings.py infos !
from local_settings import *
except ImportError:
pass
svn propedit svn:ignore local_settings.py .
<VirtualHost *>
ServerAdmin admin_contact@martincozzi.com
DocumentRoot /home/martin/code/martincozzi/
ServerName martincozzi.com
ServerAlias www.martincozzi.com
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE martincozzi.settings
PythonDebug Off
PythonPath "['/home/martin/code/'] + sys.path"
</Location>
</VirtualHost>
sudo vim /etc/apache2/sites-available/default
sudo /etc/init.d/apache2 restart
Alias /static_media/ /home/martin/code/martincozzi/templates/static_media/<Location "/static_media">SetHandler None</Location>
sudo /etc/init.d/apache2 restart