remotedjangositedevelopment
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | remotedjangositedevelopment [2015/06/09 15:23] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | [[: | ||
+ | |||
+ | DjangoSiteDevelopment | ||
+ | |||
+ | ====== Remote Development ====== | ||
+ | |||
+ | Remote development refers to development on your own computer, not " | ||
+ | machine serving the OCLUG web site. Developing remotely allows experimentation | ||
+ | with the site without broadcasting your changes to everyone. | ||
+ | users without accounts on tux to work on the site. | ||
+ | |||
+ | |||
+ | ====== Required Software ====== | ||
+ | |||
+ | For remote development of the OCLUG web site you will need the following: | ||
+ | |||
+ | * Apache 2.x with mod_wsgi | ||
+ | * Python, python-markdown and python-imaging | ||
+ | * Subversion | ||
+ | * Sqlite (or PostgreSQL or MySQL if you prefer) | ||
+ | * [[http:// | ||
+ | |||
+ | ===== Virtualenv/ | ||
+ | |||
+ | If you prefer you may use the requirements.txt to install the python requirements | ||
+ | into a virtualenv. | ||
+ | |||
+ | ===== Debian/ | ||
+ | |||
+ | Everything can be installed on recent Debian or Ubuntu systems with this command | ||
+ | run as root (or with `sudo`): | ||
+ | < | ||
+ | sudo apt-get install apache2 libapache2-mod-wsgi subversion \ | ||
+ | python python-markdown python-imaging python-pysqlite2 \ | ||
+ | python-django | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== RedHat packages ===== | ||
+ | |||
+ | or on Ret Hat/Fedora systems you will first have to download python-markdown by following | ||
+ | the link from http:// | ||
+ | < | ||
+ | cd python-markdown-* | ||
+ | python setup.py install | ||
+ | yum install httpd mod_wsgi subversion python python-imaging python-sqlite | ||
+ | </ | ||
+ | |||
+ | |||
+ | You can verify your installation by running: | ||
+ | < | ||
+ | python -c ' | ||
+ | </ | ||
+ | |||
+ | |||
+ | It should print something like `(1, 4, 1, ' | ||
+ | |||
+ | ====== Setting up the Working Directory ====== | ||
+ | |||
+ | These instructions suggest installing the code in a regular user account' | ||
+ | Make sure the user account' | ||
+ | < | ||
+ | ls -ald $HOME | ||
+ | </ | ||
+ | |||
+ | |||
+ | If the set of characters printed starting with `drwx` ends with a `-` instead of an `x` | ||
+ | then you need to change the default permissions. | ||
+ | If you do not want to make your home directory world-traversable | ||
+ | you may want to create a separate user account at this time. | ||
+ | This command will make the home directory world-traversable: | ||
+ | < | ||
+ | chmod a+x $HOME | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====== Downloading the Code and Site data ====== | ||
+ | |||
+ | Run these commands starting from your home directory to create an `oclug_site` directory | ||
+ | and download the OCLUG site code and data: | ||
+ | < | ||
+ | cd | ||
+ | mkdir oclug_site | ||
+ | cd oclug_site | ||
+ | svn co http:// | ||
+ | svn co http:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====== Site Configuration ====== | ||
+ | |||
+ | You will need to create a settings file called `local_settings.py` in your `oclug_django_site` directory: | ||
+ | < | ||
+ | cd $HOME/ | ||
+ | sed " | ||
+ | s{USERS-HOME-DIRECTORY{$HOME{;" | ||
+ | </ | ||
+ | |||
+ | |||
+ | Next set up a database and a writable directory for Apache: | ||
+ | < | ||
+ | sudo mkdir -p / | ||
+ | sudo cp -r $HOME/ | ||
+ | cd $HOME/ | ||
+ | sudo python manage.py syncdb | ||
+ | sudo python manage.py loaddata $HOME/ | ||
+ | sudo chown -R www-data: / | ||
+ | </ | ||
+ | |||
+ | |||
+ | The account you created will be used to access the `/admin/` pages on the web site. | ||
+ | |||
+ | We also need to create two symlinks to allow Apache to find some of the media files. | ||
+ | The first one lets Apache find the uploaded files in the directory writable by | ||
+ | Apache, which we created above. | ||
+ | with all its images and formatting: | ||
+ | < | ||
+ | ln -s / | ||
+ | ln -s `python -c' | ||
+ | $HOME/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====== Apache Configuration ====== | ||
+ | |||
+ | General apache configuration is covered in | ||
+ | [[https:// | ||
+ | |||
+ | If your apache is configured to use virtual hosts with a `NameVirtualHost *` | ||
+ | directive then your configuration for the | ||
+ | OCLUG Django site would look something like: | ||
+ | < | ||
+ | < | ||
+ | WSGIScriptAlias / / | ||
+ | Alias /images/ / | ||
+ | Alias /media/ / | ||
+ | Alias favicon.ico / | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | The `/images/`, `/media/` and `/ | ||
+ | All other URLs are handled by the Django site. | ||
+ | |||
+ | Restart apache and browse to `http:// | ||
+ | You can browse to `http:// | ||
+ | with the account created above. | ||
+ | |||
+ | ====== Making Changes ====== | ||
+ | |||
+ | You can make changes to the files in the `oclug_django_site` directory and restart | ||
+ | Apache to test your changes. | ||
+ | patch containing your changes to the oclug-www mailing list. To create a patch use | ||
+ | this command from the `oclug_django_site` directory: | ||
+ | < | ||
+ | svn diff > my_changes.patch | ||
+ | </ | ||
+ | |||
+ | |||
+ | Your patch will be reviewed on the mailing list by the web site maintainers. | ||
+ | |||
+ | Changes made through the administration page on the web site exist in your local | ||
+ | copy of the database and can't be moved to the OCLUG site as a patch. | ||
+ | want to suggest that sort of change, just post your request to the oclug-www mailing | ||
+ | list. | ||
+ | |||
+ | ====== Updating Your Copy ====== | ||
+ | |||
+ | You can use `svn update` to update your `oclug_django_site` directory. | ||
+ | |||
+ | To update your `site_data` and reset your local copy of the database, use these | ||
+ | commands: | ||
+ | < | ||
+ | cd oclug_site/ | ||
+ | svn update | ||
+ | sudo cp -r $HOME/ | ||
+ | cd ../ | ||
+ | sudo python manage.py loaddata ../ | ||
+ | </ | ||
+ | |||
remotedjangositedevelopment.txt · Last modified: 2015/06/09 15:23 by 127.0.0.1