export SVN_EDITOR=vim
Because vim ROCKS !
Martin
svn: Commit failed (details follow):
svn: Directory '/trunk' is out of date
svn update2. Then run
svn commit
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 .
sudo apt-get updateThis will update the apt list of software available on your machine. Then run :
sudo apt-get install apache2 php5 mysql-server libapache2-mod-auth-mysql php5-mysql phpmyadminThis will install Apache2, Php5, MysQL and PhpMyAdmin ! To finish the installation of MysQL type in :
sudo mysql_secure_installationYou are good to go ! Let me know if you have any questions.
<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