veni vidi Scripsi en Fri, 31 Oct 2014 12:07:00 GMT acrylamid 0.7.7 How I Recovered from a Corrupt Git Repository <div class="section" id="how-my-git-repository-got-corrupt-in-the-first-place"> <h3>How my Git repository got corrupt in the first place</h3> <p>Ok, so how my Git repository got corrupt was (sort of) entirely my own fault. And why it was a problem was definitely entirely my own fault.</p> <p>I had two stashes in my repository and decided for no apparent reason to pop the second stash straight after popping the first stash. Git told me there were conflicts in the second pop. I decided that I shouldn't really have popped them straight after each other (lesson #1 here) and decided to restore a Time Machine backup to get to the state where both stashes were still stashed. And that's where things went horribly wrong (lesson #2).</p> <p>After restoring the Time Machine backup I couldn't get a tree view in GitX (my GUI of choice). I did a <tt class="docutils literal">git status</tt> and that was fine, then tried to switch branch and that was not so fine. I got a <tt class="docutils literal">fatal: unable to read tree {commit hash}</tt>. Then I did a <tt class="docutils literal">git fsck</tt> and it turns out I had a lot of missing/ broken links.</p> <p>I Googled some and found several Stackoverflow questions about this topic (<a class="reference external" href="">this one</a> described my situation best), but didn't really find a solution. Some suggested that it had something to do with the <tt class="docutils literal">.git</tt> folder not being restored, but deliberately restoring it didn't help. I read something about packed and unpacked objects I couldn't really work out how that would fix my problem.</p> </div> <div class="section" id="why-it-was-a-problem-for-me"> <h3>Why it was a problem for me</h3> <p>In short: I had a local branch that hadn't been pushed to anywhere that contained a lot of work, so I couldn't just clone from somewhere and be done. Lesson #3: regularly push your branches to some other (remote) repository while you're working.</p> </div> <div class="section" id="how-i-finally-mostly-recovered-from-it"> <h3>How I finally (mostly) recovered from it</h3> <p>Like I said: I couldn't find anything that worked for me on the internet, so in the end I did the following:</p> <ol class="arabic simple"> <li>Move the corrupt repository to somewhere else;</li> <li>Re-clone the repository (master) from a remote repository (this repository obviously didn't contain my local branch);</li> <li>It turns out that the new clone only contained packed objects in the <tt class="docutils literal">.git</tt> folder;</li> <li>I copied all the unpacked objects (the folders <tt class="docutils literal">00</tt> - <tt class="docutils literal">FF</tt> in <tt class="docutils literal">.git/objects/</tt>) from my corrupt repository over to the new clone;</li> <li>Then I also copied over my local branch in <tt class="docutils literal">.git/refs/heads/</tt> to my new clone.</li> </ol> <p>I then tried to check out my local branch and that worked, however when I did a <tt class="docutils literal">git status</tt> a lot of files had been staged for deletion. I had no idea what was going on there so what I did next was:</p> <ol class="arabic simple"> <li>Push my branches to a remote repository;</li> <li>Move this repository to a temporary location in case I might need it again;</li> <li>Re-clone again from this remote repository.</li> </ol> <p>I've not got my stashes back, but there wasn't much work in them anyway and I probably could get them back if I tried. I did manage to get back the most important thing: the local branch with the huge amount of work in it.</p> </div> <div class="section" id="what-i-ve-learned"> <h3>What I've learned</h3> <p>Three things really (in order of importance):</p> <ol class="arabic simple"> <li>Regularly push your local stuff to a (remote) repository;</li> <li>Don't pop your stashes one after the other, examine the changes being applied first (I might also ask myself: should I be using stashes this much? And isn't using Time Machine to correct your Git stuff really hackish and prone to problems?);</li> <li>You cannot rely on Time Machine to restore your Git repository correctly for you (which goes hand in hand with no. 1).</li> </ol> </div> <div class="section" id="disclaimer"> <h3>Disclaimer</h3> <p>The reason I didn't regularly push my branch to a remote repository was that this branch could not yet be merged with master and therefore frequently had to be rebased on the master branch. Pushing this branch to a remote repository, then rebasing it on master and trying to push it again is <a class="reference external" href="">usually a bad idea</a>. However it can be done and since I'm not going to share this branch with anyone it would probably have been a better idea to do it anyway.</p> </div> Fri, 31 Oct 2014 12:07:00 GMT,2014-10-31:/2014/how-i-recovered-from-a-corrupt-git-repository Upgrading the Mac from Snow Leopard / Lion to Mavericks <p>In October 2013 I upgraded both my work Mac running Lion and my home Mac running Snow Leopard to Mavericks. Here's a report of the problems I ran into.</p> <ul> <li><p class="first">Creating a bootable USB no longer works as easily as it did for Mountain Lion: <a class="reference external" href=""></a>;</p> </li> <li><p class="first">On my home Mac running Snow Leopard I wanted to do a clean install. It turns out this isn't an option in the install process, instead you have to wipe your drive/partition first and then start the installation process;</p> </li> <li><p class="first">Admin password problem (didn’t notice lock), only occurred once;</p> </li> <li><p class="first">My keyboard lay-out at the login screen somehow got stuck on Dutch, even though Dutch people never use that lay-out in the first place (they use US Internatial with Dead Keys) and I'm a Dvorak typist. After some waiting and searching I found the fix: edit the system keyboard lay-out file (the user file stayed on Dvorak after I changed it) <tt class="docutils literal">/Library/Preferences/</tt> to match <tt class="docutils literal">~/Library/Preferences/</tt> (obviously after you've set it to your preferred lay-out). I experienced some edit issues: unlock symbol didn’t work, I tried to delete the file (did not recreate it), <tt class="docutils literal">sudo open</tt>, <tt class="docutils literal">sudo xcode</tt>, <tt class="docutils literal">sudo su open</tt>, <tt class="docutils literal">sudo chmod 777</tt>, <tt class="docutils literal">sudo chown heleen:staff</tt>, none of these worked. What did work in the end was: move the file to home folder, <tt class="docutils literal">chown heleen:staff</tt>, <tt class="docutils literal">chmod 777</tt>, edit, move back, <tt class="docutils literal">chown root:wheel</tt>, <tt class="docutils literal">chmod 644</tt>;</p> </li> <li><p class="first">On my work Mac I still have problems where it doesn't come back from sleep mode, but these issues already existed before the upgrade. Also, mouse click back from sleep no longer works. You have to use a keyboard stroke;</p> </li> <li><p class="first">Python segfaulted at every possible command (even <tt class="docutils literal">python 3+2</tt> seemed to segfault). The solution is this: <a class="reference external" href=""></a>;</p> </li> <li><p class="first">In Mac's Apache PHP &amp; virtualhosts were no longer enabled: <a class="reference external" href=""></a> &amp; <a class="reference external" href=""></a>;</p> </li> <li><p class="first">Virtualbox host-only networks don't work: <a class="reference external" href=""></a>;</p> </li> <li><p class="first">Clang errors:</p> <blockquote> <ul class="simple"> <li>Make sure you've installed all extra updates via Mac Software Update (this will include an XCode update);</li> <li>Don't forget to accept the Licence Agreement in XCode (either start XCode or type <tt class="docutils literal">ac</tt> in the terminal): <a class="reference external" href=""></a></li> <li>If you get a <tt class="docutils literal">clang: error: unknown argument</tt> error use: <tt class="docutils literal"><span class="pre">ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future</span> pip install fabric</tt> (where <tt class="docutils literal">pip install fabric</tt> is whatever command you were trying to run), <a class="reference external" href=""></a></li> </ul> </blockquote> </li> <li><p class="first">Somehow my Maven had disappeared (you get a <tt class="docutils literal"><span class="pre">-bash:</span> mvn: command not found</tt> error when you type <tt class="docutils literal">mvn <span class="pre">--version</span></tt>), apparently Apple uninstalled it, this doesn't always happen I don't think. Anyway, there are two ways to install Maven:</p> <blockquote> <ol class="arabic simple"> <li>Use the instructions on the Apache website (this is what I did): <a class="reference external" href=""></a> (chapter: Unix based operating systems). Be sure to put all the <tt class="docutils literal">export</tt> commands in your <tt class="docutils literal">.bashrc</tt> instead of executing them in the terminal because the latter didn't work for me;</li> <li>Use Homebrew.</li> </ol> </blockquote> </li> </ul> <p>I believe that's every problem I ran into. I may update it in the future. If you have questions feel free to send me an e-mail (e-mail address under my name at the bottom of the page).</p> Wed, 02 Apr 2014 15:53:00 GMT,2014-04-02:/2014/upgrading-to-mavericks Installing & Running Plone 4.3 on Mac OS X Mavericks <p>So, I'm finally getting to know Plone. We will be using it for the company website and I should be getting a short training in working and developing with Plone so I can take on the maintenance of the website after delivery.</p> <p>I had some extra time to delve into Plone before the training and I have to say: Plone definitely has a steep learning curve. It toke me forever just to get it up and running (not being familiar with zc.buildout doesn't help). Just now I had to help my colleague getting everything up and running and he ran into many of the same problems as I did, so I thought I'd document the process for future reference.</p> <p>My coleague started with using the default packaged installer, but then couldn't get it running (something wrong with port numbers). So I suggested he'd try the <a class="reference external" href="">'developer' buildout install</a>, which is what I used as a reference. So, let's get started.</p> <div class="section" id="preparations"> <h3>Preparations</h3> <ol class="arabic"> <li><p class="first">Make sure you've got XCode installed;</p> </li> <li><p class="first">Install <a class="reference external" href="">pip</a>, use the instructions in the documentation;</p> </li> <li><p class="first">Install <a class="reference external" href="">virtualenv</a> and <a class="reference external" href="">virtualenvwrapper</a> (the latter is not strictly necessary, but will make your life a lot easier):</p> <div class="highlight"><pre>sudo pip install virtualenv virtualenvwrapper </pre></div> </li> <li><p class="first">I have a special folder in my system where I keep all my virtualenvs together (in <tt class="docutils literal">/Volumes/DATA/virtualenvs</tt> - yes, I have 2 partitions on my Mac - ). If you have the same you can use the following code in your <tt class="docutils literal">.bashrc</tt> to be able to quickly start (source) virtualenvs. This code also makes sure that pip only works when a virtualenv is active (you will not be able to install Python modules in the global <tt class="docutils literal"><span class="pre">site-packages</span></tt> folder using pip unless you disable that line in <tt class="docutils literal">.bashrc</tt>):</p> <div class="highlight"><pre><span class="c">##### PIP/Virtualenvwrapper config ############################################</span> <span class="nb">export </span><span class="nv">PIP_REQUIRE_VIRTUALENV</span><span class="o">=</span><span class="nb">true</span> <span class="nb">source</span> /usr/local/bin/ <span class="nb">export </span><span class="nv">WORKON_HOME</span><span class="o">=</span>/Volumes/DATA/virtualenvs <span class="c">###############################################################################</span> </pre></div> <p>Don't forget to resource your <tt class="docutils literal">.bashrc</tt>:</p> <div class="highlight"><pre>. ~/.bashrc </pre></div> </li> <li><p class="first">Create a virtualenv for your Plone installation:</p> <div class="highlight"><pre><span class="nb">cd</span> /Volumes/DATA/virtualenvs mkvirtualenv plone </pre></div> <p>The virtualenv is automatically activated when you create it. To deactivate it type <tt class="docutils literal">deactivate</tt>. To start (activate) it when it's not active type <tt class="docutils literal">workon plone</tt> (here's where the <tt class="docutils literal">.bashrc</tt>/virtualenvwrapper magic comes in, you can do this wherever you are on the system).</p> </li> </ol> </div> <div class="section" id="installing-plone"> <h3>Installing Plone</h3> <p>Everything from here on is done with the virtualenv active.</p> <ol class="arabic"> <li><p class="first">Now install ZopeSkel:</p> <div class="highlight"><pre>pip install <span class="s1">&#39;ZopeSkel&lt;2.99&#39;</span> </pre></div> </li> <li><p class="first">Go somewhere on your system where you would like Plone to live (this does not have to be in your virtualenv, in fact I prefer very much to keep them separated) and do:</p> <div class="highlight"><pre>paster create -t plone4_buildout myplonefolder </pre></div> <p>When it asks for the version number the default is 4.1. This is NOT the latest version. Please type in 4.3 (or the latest version number which you should be able to find on the <a class="reference external" href="">Plone website</a>). It has now created a folder <tt class="docutils literal">myplonefolder</tt> with some necessary buildout files.</p> </li> <li><p class="first">Go into the new folder and run:</p> <div class="highlight"><pre>python </pre></div> <p>Now you might run into the following error:</p> <div class="highlight"><pre>Traceback <span class="o">(</span>most recent call last<span class="o">)</span>: File <span class="s2">&quot;;</span>, line 97, in &lt;module&gt; <span class="nv">pythonpath</span> <span class="o">=</span> ws.find<span class="o">(</span>pkg_resources.Requirement.parse<span class="o">(</span>requirement<span class="o">))</span>.location AttributeError: <span class="s1">&#39;NoneType&#39;</span> object has no attribute <span class="s1">&#39;location&#39;</span> </pre></div> <p>To solve this you have to install <tt class="docutils literal">distribute</tt> and rerun <tt class="docutils literal">python</tt>:</p> <div class="highlight"><pre>pip install distribute </pre></div> </li> <li><p class="first">Now run the following (this will take a while):</p> <div class="highlight"><pre>bin/buildout </pre></div> <p>And again you might run into errors, mainly the following:</p> <ul> <li><p class="first">Remove dumppickedversions:</p> <div class="highlight"><pre>While: Installing. Loading extensions. Error: Buildout now includes <span class="s1">&#39;buildout-versions&#39;</span> <span class="o">(</span>and part of the older <span class="s1">&#39;buildout.dumppickedversions&#39;</span><span class="o">)</span>. Remove the extension from your configuration and look at the <span class="s1">&#39;show-picked-versions&#39;</span> option in buildout<span class="err">&#39;</span>s documentation. </pre></div> <p>Solve this by editing <tt class="docutils literal">buildout.cfg</tt> and removing (or commenting out) <tt class="docutils literal">buildout.dumppickedversions</tt> from <tt class="docutils literal">extensions</tt> on line 26 and rerun <tt class="docutils literal">bin/buildout</tt>:</p> <div class="highlight"><pre><span class="nv">extensions</span> <span class="o">=</span> mr.developer <span class="c"># buildout.dumppickedversions</span> </pre></div> </li> <li><p class="first">ZopeSkel version conflict:</p> <div class="highlight"><pre>Got zopeskel.dexterity 1.5.2. While: Installing zopeskel. Error: There is a version conflict. We already have: ZopeSkel 3.0b3 but zopeskel.dexterity 1.5.2 requires <span class="s1">&#39;ZopeSkel&lt;=3.0dev&#39;</span>. </pre></div> <p>Solve this by editing the <tt class="docutils literal">buildout.cfg</tt> file and adding <tt class="docutils literal">&lt;=3.0dev</tt> to <tt class="docutils literal">ZopeSkel</tt> on line 83 and rerun <tt class="docutils literal">bin/buildout</tt>:</p> <div class="highlight"><pre><span class="o">[</span>zopeskel<span class="o">]</span> <span class="nv">recipe</span> <span class="o">=</span> zc.recipe.egg <span class="nv">eggs</span> <span class="o">=</span> ZopeSkel&lt;<span class="o">=</span>3.0dev PasteScript zopeskel.dexterity </pre></div> </li> </ul> </li> </ol> </div> <div class="section" id="starting-plone"> <h3>Starting Plone</h3> <p>Finally you can start plone by running the following command from the Plone folder:</p> <div class="highlight"><pre>bin/instance <span class="nb">fg</span> </pre></div> <p>By using <tt class="docutils literal">fg</tt> you make it run in the foreground so you get error messages in the terminal.</p> <p>You no longer need your virtualenv active for this. The virtualenv Python interpreter is defined at the start of <tt class="docutils literal">instance</tt> so it actually uses the virtualenv even if it's not active when you run <tt class="docutils literal">instance</tt>.</p> <p>You might get an error about an 'unknown locale: UTF-8'. You can solve this by adding the following to your <tt class="docutils literal">.bashrc</tt>, sourcing <tt class="docutils literal">.bashrc</tt> and restarting Plone.</p> <div class="highlight"><pre><span class="nb">export </span><span class="nv">LANG</span><span class="o">=</span><span class="s2">&quot;en_US.UTF-8&quot;</span> <span class="nb">export </span><span class="nv">LC_COLLATE</span><span class="o">=</span><span class="s2">&quot;en_US.UTF-8&quot;</span> <span class="nb">export </span><span class="nv">LC_CTYPE</span><span class="o">=</span><span class="s2">&quot;en_US.UTF-8&quot;</span> <span class="nb">export </span><span class="nv">LC_MESSAGES</span><span class="o">=</span><span class="s2">&quot;en_US.UTF-8&quot;</span> <span class="nb">export </span><span class="nv">LC_MONETARY</span><span class="o">=</span><span class="s2">&quot;en_US.UTF-8&quot;</span> <span class="nb">export </span><span class="nv">LC_NUMERIC</span><span class="o">=</span><span class="s2">&quot;en_US.UTF-8&quot;</span> <span class="nb">export </span><span class="nv">LC_TIME</span><span class="o">=</span><span class="s2">&quot;en_US.UTF-8&quot;</span> <span class="nb">export </span><span class="nv">LC_ALL</span><span class="o">=</span><span class="s2">&quot;en_US.UTF-8&quot;</span> </pre></div> <div class="topic"> <p class="topic-title first">Resources</p> <ul class="simple"> <li><a class="reference external" href="">ZopeSkel version conflic error solution</a>;</li> <li><a class="reference external" href="">Attribute error solution</a>;</li> <li><a class="reference external" href="">UTF-8 locale error solution</a>.</li> </ul> </div> </div> Mon, 20 Jan 2014 15:53:00 GMT,2014-01-20:/2014/installing-and-running-plone-on-mac-osx-mavericks Recipe: Spinach, Tomato, Goat's Cheese, Potato & Egg Wraps <p>The other day we had some spinach left after using half of the 300g bag in a risotto and I wondered what to make with it. I wanted to finish it since we were going to be away for a couple of days and I didn't want to just bin it. Normally I use it in a curry, but we'd be going out for diner to an Indian restaurant, so that wasn't an option.</p> <p>I remembered the wraps we made a while ago and thought we could make some wraps with the spinach. I cooked up my own recipe with the spinach and goat's cheese we still had left in the fridge and a hint from the web to use some tomatoes. I thought it was pretty delicious so here's the recipe.</p> <img alt="/IMAG3856.jpg" src=""/> <div class="section" id="ingredients-for-2-persons-makes-4-wraps"> <h3>Ingredients for 2 persons (makes 4 wraps)</h3> <ul class="simple"> <li>150-200 grams of fresh spinach leaves</li> <li>some goat's cheese (or use crème fraîche or cream cheese)</li> <li>2 eggs</li> <li>3 tomatoes, diced</li> <li>a couple of potatoes (we used about 400 grams unpeeled)</li> <li>4 wholemeal wraps</li> <li>salt</li> <li>pepper</li> </ul> </div> <div class="section" id="instructions"> <h3>Instructions</h3> <p>Peel the potatoes and boil them for about 20 minutes until they're done (follow the instructions if they come in packaging). Meanwhile boil the eggs in roughly 6-7 minutes (if you like them soft boiled like me, or longer if you prefer hard boiled eggs). In a frying pan fry the tomatoes for about 3 minutes, when ready add the spinach and fry until wilted in about 4 minutes.</p> <p>Warm the wraps in the microwave according to instructions. Serve immediately.</p> <p>We smeared the goat's cheese on the wrap first, then we mashed a potato (or two) on top. Add some pepper and salt. Add half of the boiled egg (you can mush it with the potato or just chop it up, whatever you like). Then add a quarter of the spinach-tomato mixture. Et voilà!</p> </div> <div class="section" id="update-april-2nd-2014"> <h3>Update April 2nd, 2014</h3> <p>One day we forgot to buy the goat's cheese and discovered that we actually prefer these wraps with 4 eggs (1 whole egg per wrap) and about 2 teapoons of mayonaise per wrap. It makes the wrap feel more together, with the goat's cheese I feel the flavours are too far apart. We prefer to use Gouda's Glorie mayonaise (in a glass jar, not the squeezy plastic bottle) (or AH own brand glass jar if you can't find it) in case you happen to live in the Netherlands.</p> </div> Tue, 24 Dec 2013 16:53:00 GMT,2013-12-24:/2013/recipe_spinach_tomato_wraps Mac OS X Apache Mass VHosts (with support for htaccess and symlinks) <p>A while ago I wrote two posts, one on <a class="reference external" href="">using Twig</a> and another on <a class="reference external" href="">using htaccess with Mac's Apache</a>. I was reasonably happy with the described setups until I discovered that when I used something like <tt class="docutils literal">&lt;link <span class="pre">rel=&quot;stylesheet&quot;</span> <span class="pre">href=&quot;/style.css&quot;</span> <span class="pre">media=&quot;all&quot;&gt;</span></tt> in my HTML it wouldn't work because my site was running at the default <tt class="docutils literal"><span class="pre">http://localhost/~heleen/website/index.html</span></tt> and so it would map the 'root' slash to <tt class="docutils literal"><span class="pre">http://localhost/</span></tt> rather than <tt class="docutils literal"><span class="pre">http://localhost/~heleen/website/</span></tt>. I found a solution to this using <a class="reference external" href="">vhosts</a>, which works really well. But then I had to add another website, and another, and realised that surely there should be an easier way to do this.</p> <p>After some searching and trial and error I finally found my ideal setup. Unfortunately I couldn't execute the last step of the process (dnsmasq) because of some silly errors, but here's my PHP/Apache setup if you're interested (running Mac OS X 10.9 - Mavericks -).</p> <p>If I've missed anything or if you have questions please don't hesitate to send me an e-mail (or comment once I've got the comments up and running).</p> <div class="note"> <p class="first admonition-title">Note</p> <p class="last">My language of choice is actually Python and for a motivation for setting this up in the first place I would like to refer to my <a class="reference external" href="">Twig post</a>.</p> </div> <div class="section" id="turn-on-apache-and-php-on-your-mac"> <h3>Turn on Apache and PHP on your Mac</h3> <ol class="arabic"> <li><p class="first">Turn on Apache:</p> <ul class="simple"> <li>On Lion and below machines: turn <tt class="docutils literal">Web Sharing</tt> on in your Mac's <tt class="docutils literal">System Preferences</tt> <tt class="docutils literal">Sharing</tt>. It will display the IP on where you can view the pages from your <tt class="docutils literal">Sites</tt> directory. I don't know how this would work on Mountain Lion as they've removed that option from the sharing preferences;</li> <li>On Mountain Lion and above machines execute the following command <tt class="docutils literal">sudo apachectl start</tt>;</li> </ul> </li> <li><p class="first">Turn on PHP support in Apache by editing <tt class="docutils literal">/private/etc/apache2/httpd.conf</tt> and uncommenting the line:</p> <pre class="brush: apacheconf"> LoadModule php5_module libexec/apache2/ </pre> </li> <li><p class="first">Create the PHP.ini file by going to <tt class="docutils literal">/private/etc/</tt> and doing <tt class="docutils literal">sudo cp php.ini.default php.ini</tt>. I also turned debug mode on: search for <tt class="docutils literal">display_errors</tt> in <tt class="docutils literal">php.ini</tt> and make sure that <tt class="docutils literal">Default Value</tt> is set to <tt class="docutils literal">On</tt>.</p> </li> <li><p class="first">Create a <tt class="docutils literal"><span class="pre">/Users/[your_computer_username]/Sites</span></tt> directory if it doesn't already exist;</p> </li> <li><p class="first">If you'd like to run projects from other directories (like I do) I recommend simlinking to them from your Sites directory. However that does mean that you'll have to turn this feature on in Apache by adding <tt class="docutils literal">FollowSymLinks</tt> to <tt class="docutils literal">Options Indexes Multiviews</tt> in <tt class="docutils literal"><span class="pre">/etc/apache2/users/[your_computer_username].conf</span></tt>. <a class="reference external" href="">See this Stackoverflow question</a>; OR follow along and use the setup below in the Using Virtual Hosts section.</p> </li> <li><p class="first">Restart Apache: <tt class="docutils literal">sudo apachectl graceful</tt>.</p> </li> </ol> </div> <div class="section" id="using-mass-virtual-hosts"> <h3>Using Mass Virtual Hosts</h3> <p>This method makes adding websites to your <tt class="docutils literal">Sites</tt> directory and running them a one action event. All you have to do is create (or symlink) the folder in the <tt class="docutils literal">Sites</tt> directory.</p> <ol class="arabic"> <li><p class="first">Make sure that in <tt class="docutils literal">/etc/apache2/httpd.conf</tt> the following lines are enabled (not commented out) (this requires Apache v1.3.6 or above (default in Mac OS X Mavericks is 2.2.24):</p> <pre class="brush: apacheconf"> Include /private/etc/apache2/extra/httpd-userdir.conf Include /private/etc/apache2/extra/httpd-vhosts.conf LoadModule vhost_alias_module libexec/apache2/ </pre> </li> <li><p class="first">Make sure your <tt class="docutils literal"><span class="pre">/etc/apache2/users/[your_computer_username].conf</span></tt> consists of the following lines:</p> <pre class="brush: apacheconf"> &lt;VirtualHost *:80> UseCanonicalName Off VirtualDocumentRoot /Users/[your_computer_username]/Sites/%0 &lt;/VirtualHost> &lt;Directory "/Users/[your_computer_username]/Sites"> Options Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews AllowOverride All Order allow,deny Allow from all &lt;/Directory> </pre> <p>You will need the <tt class="docutils literal">Directory</tt> directive to be able to use <tt class="docutils literal">htaccess</tt> and symlinks.</p> </li> <li><p class="first">Restart Apache: <tt class="docutils literal">sudo apachectl graceful</tt>;</p> </li> </ol> <p>Now you can either install dnsmasq, a lightweight DNS forwarder and DHCP server, to do the domain/hostnaming automatically, or you can opt to add one step to the website installation: adding a line to <tt class="docutils literal">/etc/hosts</tt> for each website.</p> <div class="note"> <p class="first admonition-title">Note</p> <p class="last">This setup writes all log entries to the default Apache log <tt class="docutils literal">/var/log/apache2/</tt>. For custom logging you will have to search the internet yourself.</p> </div> <div class="section" id="no-dnsmasq"> <h4>No Dnsmasq</h4> <p>If you opt for the latter all you need to do is add the following line to your <tt class="docutils literal">/etc/hosts</tt> file for each website you add to your <tt class="docutils literal">Sites</tt> folder:</p> <pre class="literal-block"> [your-site-folder-name] </pre> <p>I usually use <tt class="docutils literal"><span class="pre"></span></tt> for the folder name and hostname.</p> </div> <div class="section" id="dnsmasq"> <h4>Dnsmasq</h4> <p>You can also use Dnsmasq to manage the domains. It is normally installed via <a class="reference external" href="">Homebrew</a> on a Mac, however some strange behaviour on my Mac prevented me from installing Dnsmasq with it (it also wouldn't build from source). I have included some documentation, but for now I'm afraid you're on your own.</p> <div class="topic"> <p class="topic-title first">Resources</p> <p>htaccess on a Mac</p> <ul class="simple"> <li><a class="reference external" href="">Apache + .htaccess + Mac OS X</a>;</li> <li><a class="reference external" href="">Stackoverflow question: 'Install CakePHP on Mac OS X: Apache Problems'</a>.</li> </ul> <p>Apache + PHP Setup</p> <ul class="simple"> <li><a class="reference external" href="">PHP.ini</a>;</li> <li><a class="reference external" href="">Starting PHP and Apache on a Mac</a>;</li> <li><a class="reference external" href="">Simlinking from the Sites folder on a Mac</a>.</li> </ul> <p>VirtualHosts</p> <ul class="simple"> <li><a class="reference external" href="">VHOSTS on Mac Leopard</a>;</li> <li><a class="reference external" href="">Install Apache PHP MySQL on Mac OS X</a>;</li> <li><a class="reference external" href="">How to install Apache and PHP on a Mac OS X 10.8 MAMP part 1</a>.</li> </ul> <p>Mass Virtual Hosts</p> <ul class="simple"> <li><a class="reference external" href="">Example VirtualHost Apache Configuration</a>, this is the one I actually used;</li> <li><a class="reference external" href="">Apache Virtual Host</a>;</li> <li><a class="reference external" href="">Apache Setup</a>;</li> <li><a class="reference external" href="">Apache Dynamic Virtual Hosts</a>;</li> <li><a class="reference external" href="">Apache Docs on Mass VHosts</a>.</li> </ul> <p>Dnsmasq</p> <ul class="simple"> <li><a class="reference external" href="">Local Development with Dnsmasq</a>;</li> <li><a class="reference external" href="">Debian Dnsmasq Howto</a>;</li> <li><a class="reference external" href="">Setting up dnsmasq for Local Web Development Testing on any Device</a>;</li> <li><a class="reference external" href="">Never Touch Your Local /etc/hosts File OS X Again</a>.</li> </ul> </div> </div> </div> Thu, 28 Nov 2013 12:39:00 GMT,2013-11-28:/2013/mac-apache-mass-vhosts Getting htaccess to work on a Mac (Lion) with Apache and using symlinks <p>Edit (<tt class="docutils literal">sudo</tt>) <tt class="docutils literal"><span class="pre">/etc/apache2/users/[your-username].conf</span></tt>:</p> <ol class="arabic simple"> <li>Add <tt class="docutils literal">DocumentRoot <span class="pre">&quot;/Users/[your-username]/Sites/&quot;</span></tt> at the top of the file;</li> <li>Add <tt class="docutils literal">FollowSymLinks</tt> to the <tt class="docutils literal">Options</tt>;</li> <li>Change <tt class="docutils literal">AllowOverride None</tt> to <tt class="docutils literal">AllowOverride All</tt>;</li> <li>Change <tt class="docutils literal">Deny from All</tt> to <tt class="docutils literal">Allow from All</tt>.</li> </ol> <p>Original:</p> <pre class="literal-block"> &lt;Directory &quot;/Users/[your-username]/Sites/&quot;&gt; Options Indexes MultiViews AllowOverride None Order allow,deny Deny from All &lt;/Directory&gt; </pre> <p>New:</p> <pre class="literal-block"> DocumentRoot &quot;/Users/[your-username]/Sites/&quot; &lt;Directory &quot;/Users/[your-username]/Sites/&quot;&gt; Options Indexes MultiViews FollowSymLinks AllowOverride All Order allow,deny Allow from All &lt;/Directory&gt; </pre> <p>Restart Apache: <tt class="docutils literal">sudo apachectl graceful</tt></p> <div class="topic"> <p class="topic-title first">Resources</p> <ul class="simple"> <li><a class="reference external" href="">Apache + .htaccess + Mac OS X</a></li> <li><a class="reference external" href="">Stackoverflow question: 'Install CakePHP on Mac OS X: Apache Problems'</a></li> </ul> </div> Tue, 14 May 2013 10:58:40 GMT,2013-05-14:/2013/getting-htaccess-work-mac-lion-apache-and-using-sy PIL, JPEG and Freetype support on Mac OS X Lion when using Virtualenv <p>Assuming you're using virtualenv and pip and working in your virutalenv (<tt class="docutils literal"><span class="pre">(your-env)username&#64;computer:~$</span></tt>).</p> <ol class="arabic"> <li><p class="first">Download PIL, but do not install it:</p> <pre class="brush: bash"> $ pip install --no-install PIL </pre> </li> <li><p class="first">For Freetype support: edit <tt class="docutils literal"></tt> in <tt class="docutils literal"><span class="pre">{your-virtualenv-folder}/build/PIL</span></tt>. On line 40 change <tt class="docutils literal">FREETYPE_ROOT = None</tt> to <tt class="docutils literal">FREETYPE_ROOT = <span class="pre">libinclude('/usr/X11')</span></tt>:</p> <div class="highlight"><pre><span class="c"># Library pointers.</span> <span class="c">#</span> <span class="c"># Use None to look for the libraries in well-known library locations.</span> <span class="n">Theme</span><span class="p">:</span> <span class="n">Basic</span> <span class="n">Nature</span> <span class="c"># Use a string to specify a single directory, for both the library and</span> <span class="c"># the include files. Use a tuple to specify separate directories:</span> <span class="c"># (libpath, includepath). Examples:</span> <span class="c">#</span> <span class="c"># JPEG_ROOT = &quot;/home/libraries/jpeg-6b&quot;</span> <span class="c"># TIFF_ROOT = &quot;/opt/tiff/lib&quot;, &quot;/opt/tiff/include&quot;</span> <span class="c">#</span> <span class="c"># If you have &quot;lib&quot; and &quot;include&quot; directories under a common parent,</span> <span class="c"># you can use the &quot;libinclude&quot; helper:</span> <span class="c">#</span> <span class="c"># TIFF_ROOT = libinclude(&quot;/opt/tiff&quot;)</span> <span class="n">TCL_ROOT</span> <span class="o">=</span> <span class="bp">None</span> <span class="n">JPEG_ROOT</span> <span class="o">=</span> <span class="bp">None</span> <span class="n">ZLIB_ROOT</span> <span class="o">=</span> <span class="bp">None</span> <span class="n">TIFF_ROOT</span> <span class="o">=</span> <span class="bp">None</span> <span class="n">FREETYPE_ROOT</span> <span class="o">=</span> <span class="n">libinclude</span><span class="p">(</span><span class="s">&#39;/usr/X11&#39;</span><span class="p">)</span> <span class="n">LCMS_ROOT</span> <span class="o">=</span> <span class="bp">None</span> <span class="c"># FIXME: add mechanism to explicitly *disable* the use of a library</span> <span class="c"># --------------------------------------------------------------------</span> </pre></div> </li> <li><p class="first">Get <tt class="docutils literal">libjpeg</tt> (choose any version, when I installed v9 was the latest):</p> <pre class="brush: bash"> $ curl -O $ tar zxvf jpegsrc.v9.tar.gz $ cd jpeg-9/ $ ./configure $ make $ sudo make install </pre> </li> <li><p class="first">Install PIL:</p> <pre class="brush: bash"> $ pip install PIL </pre> </li> </ol> <p>Done!</p> <div class="topic"> <p class="topic-title first">Resources</p> <ul class="simple"> <li><a class="reference external" href="">Install libjpeg on Mac</a></li> <li><a class="reference external" href="">Get PIL to recognise Freetype install on a Mac</a></li> </ul> </div> Thu, 02 May 2013 11:04:03 GMT,2013-05-02:/2013/pil-jpeg-and-freetype-support-mac-os-x-lion Installing Gettext on Mac OS X Lion <p>Just now I tried to use <tt class="docutils literal"><span class="pre"></span> makemessages</tt> to create a language file and got the following error: <tt class="docutils literal">/bin/sh: xgettext: command not found</tt>. After a search on my system it turns out I don't have gettext installed.</p> <p>I did some searching and found mac-ports solutions, but I'm not a big fan of them. I tried compiling myself and got the following errors:</p> <pre class="literal-block"> stpncpy.c:34: error: expected declaration specifiers or ‘…’ before numeric constant stpncpy.c:34: error: expected ‘)’ before ‘!=’ token stpncpy.c:34: error: expected ‘)’ before ‘?’ token make[3]: *** [stpncpy.lo] Error 1 make[2]: *** [install] Error 2 make[1]: *** [install-recursive] Error 1 make: *** [install-recursive] Error 1 </pre> <p>I didn't give up though and eventually found this patch through <a class="reference external" href="">this link</a>: <a class="reference external" href=""></a>. And this worked, hurray!</p> <div class="note"> <p class="first admonition-title">Note</p> <p class="last">I downloaded gettext from <a class="reference external" href=""></a> and used version</p> </div> Wed, 31 Oct 2012 10:17:22 GMT,2012-10-31:/2012/installing-gettext-mac-os-x-lion Oh no! I've Forgotten my Django Admin Password! <p>And here's how to reset it if you can still reach the installation via SSH or similar.</p> <p>Start a Django shell:</p> <pre class="literal-block"> python shell </pre> <p>Use the following code to change the password:</p> <pre class="literal-block"> from django.contrib.auth.models import User u = User.objects.get(username__exact='[username]') u.set_password('[fill in new password here]') exit() </pre> <p>That's all!</p> <div class="section" id="sources"> <h3>Sources</h3> <ul class="simple"> <li><a class="reference external" href="">Running the Django Shell</a></li> <li><a class="reference external" href="">Changing the password</a></li> </ul> </div> Fri, 17 Aug 2012 22:26:22 GMT,2012-08-17:/2012/oh-no-ive-forgotten-my-django-admin-password Quick Templating System for HTML Page Mock-ups (Mac OS X specific) <p>For the project I am currently working on at my job I needed to make some HTML page mock-ups. The HTML and CSS were already available within the current version of the website, I just needed to restructure the content a bit and make a few mock-ups of it to see what sort of issues we'd run into.</p> <p>Initially I just copied the HTML and replaced the old content with the new content. Then I made another copy and replaced it with different content. I then realised what I needed was a tempting system. If I was going to make 10 pages and some basic thing changed I'd have to modify 10 pages which is just silly.</p> <p>My requirements were the following:</p> <ol class="arabic simple"> <li>It needed to be quick and easy and not overkill. I didn't want to have to install a whole framework like <a class="reference external" href="">Django</a> or <a class="reference external" href="">Symfony</a>;</li> <li>It needed to be based on inheritance. Ever since I learned Django I'm in love with their inheritance templating system and I wouldn't have it any other way (read: includes);</li> <li>It needed to be portable. I will probably have to share the HTML/code with other people and they should be able to run it in minutes.</li> </ol> <p>So I searched around a bit and eventually landed on <a class="reference external" href="">Twig</a>. Now I'm not a big fan of PHP, you can read why <a class="reference external" href="">HERE</a>. But I (and my colleagues) work on a Mac which has PHP and Apache installed by default. You just need to turn it on.</p> <p>The big plus of Twig is that it uses the same syntax as the Django templating system which means there was no learning curve for me. However my PHP was very rusty, so getting it up and running took a little longer.</p> <div class="section" id="how-i-made-it-work"> <h3>How I made it work</h3> <div class="section" id="turn-on-apache-and-php-on-your-mac"> <h4>Turn on Apache and PHP on your Mac</h4> <p>You can skip this if you've got it all set-up and running.</p> <ol class="arabic simple"> <li>Turn <tt class="docutils literal">Web Sharing</tt> on in your Mac's <tt class="docutils literal">System Preferences</tt> <tt class="docutils literal">Sharing</tt>. It will display the IP on where you can view the pages from your <tt class="docutils literal">Sites</tt> directory. I don't know how this would work on Mountain Lion as they've removed that option from the sharing preferences;</li> <li>Apache is turned on by default (at least it was on my Mac OS X Lion);</li> <li>Turn on PHP support in Apache by editing <tt class="docutils literal">/private/etc/apache2/httpd.conf</tt> and uncommenting the line <tt class="docutils literal">LoadModule php5_module&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libexec/apache2/</tt>;</li> <li>Create the PHP.ini file by going to <tt class="docutils literal">/private/etc/</tt> and doing <tt class="docutils literal">sudo cp php.ini.default php.ini</tt>. I also turned debug mode on: search for <tt class="docutils literal">display_errors</tt> in <tt class="docutils literal">php.ini</tt> and make sure that <tt class="docutils literal">Default Value</tt> is set to <tt class="docutils literal">On</tt>.</li> <li>Create a <tt class="docutils literal"><span class="pre">/Users/[your_computer_username]/Sites</span></tt> directory if it doesn't already exist;</li> <li>If you'd like to run projects from other directories (like I do) I recommend simlinking to them from your Sites directory. However that does mean that you'll have to turn this feature on in Apache by adding <tt class="docutils literal">FollowSymLinks</tt> to <tt class="docutils literal">Options Indexes Multiviews</tt> in <tt class="docutils literal"><span class="pre">/etc/apache2/users/[your_computer_username].conf</span></tt>. <a class="reference external" href="">See this Stackoverflow question</a>;</li> <li>Restart Apache: <tt class="docutils literal">sudo apachectl restart</tt>.</li> </ol> </div> <div class="section" id="using-twig-standalone"> <h4>Using Twig 'Standalone'</h4> <ol class="arabic simple"> <li>I'm assuming you have a folder somewhere which contains both 'base' template HTML files and the actual 'content' HTML files which inherit the base files (and which I also, for the sake of convienience, have declared to be template files), which make use of the Twig templating system. Don't forget to create the simlink from the <tt class="docutils literal">Sites</tt> directory to your project if you've not put them in <tt class="docutils literal">Sites</tt>;</li> <li><a class="reference external" href="">Download Twig</a> and unzip;</li> <li>Place the contents somewhere useful. It doesn't matter where, I put them in my Sites folder. As a side-note: the actual working bit is the <tt class="docutils literal">Twig</tt> folder in <tt class="docutils literal">lib</tt> in the extracted folder, the rest is docs and tests. I got this wrong at first so pay attention to this;</li> <li>I created the following configuration/loader PHP file to run my HTML files through the tempting engine. I placed it in my project folder with the HTML files. Replace the <tt class="docutils literal">$twigPath</tt> variable with the path to your own Twig install. More specifically to the <tt class="docutils literal">Autoloader.php</tt> file. And finally point the <tt class="docutils literal">$templatesPath</tt> to where you've stored your HTML files (step 1):</li> </ol> <div class="highlight"><pre><span class="lineno"> 1</span> <span class="x"> </span><span class="cp">&lt;?php</span> <span class="lineno"> 2</span> <span class="cm">/* File: loader.php</span> <span class="lineno"> 3</span> <span class="cm"> * Usage: loader.php?file=[filename] (without .html)</span> <span class="lineno"> 4</span> <span class="cm"> * E.g.:</span> <span class="lineno"> 5</span> <span class="cm"> * Don&#39;t forget to EDIT the CONFIG</span> <span class="lineno"> 6</span> <span class="cm"> * Dependencies: Twig (</span> <span class="lineno"> 7</span> <span class="cm"> */</span> <span class="lineno"> 8</span> <span class="sd">/*** Config ****************/</span> <span class="lineno"> 9</span> <span class="nv">$twigPath</span> <span class="o">=</span> <span class="s1">&#39;/Users/heleen/Sites/Twig/lib/Twig/Autoloader.php&#39;</span><span class="p">;</span> <span class="c1">// Path to Twig&#39;s Autoloader</span> <span class="lineno">10</span> <span class="nv">$templatesPath</span> <span class="o">=</span> <span class="s1">&#39;/Users/heleen/Sites/OAPDemonstrator&#39;</span><span class="p">;</span> <span class="c1">// Path to your HTML templates</span> <span class="lineno">11</span> <span class="sd">/***************************/</span> <span class="lineno">12</span> <span class="lineno">13</span> <span class="k">require_once</span> <span class="nv">$twigPath</span><span class="p">;</span> <span class="lineno">14</span> <span class="nx">Twig_Autoloader</span><span class="o">::</span><span class="na">register</span><span class="p">();</span> <span class="lineno">15</span> <span class="lineno">16</span> <span class="c1">// set up Twig</span> <span class="lineno">17</span> <span class="nv">$loader</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Twig_Loader_Filesystem</span><span class="p">(</span><span class="nv">$templatesPath</span><span class="p">);</span> <span class="lineno">18</span> <span class="nv">$twig</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Twig_Environment</span><span class="p">(</span><span class="nv">$loader</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span> <span class="s1">&#39;cache&#39;</span> <span class="o">=&gt;</span> <span class="k">false</span><span class="p">));</span> <span class="lineno">19</span> <span class="lineno">20</span> <span class="c1">// parse the template</span> <span class="lineno">21</span> <span class="nv">$template_file</span> <span class="o">=</span> <span class="nb">htmlspecialchars</span><span class="p">(</span><span class="nv">$_GET</span><span class="p">[</span><span class="s2">&quot;file&quot;</span><span class="p">]);</span> <span class="lineno">22</span> <span class="nv">$bindings</span> <span class="o">=</span> <span class="k">array</span><span class="p">();</span> <span class="lineno">23</span> <span class="nv">$template</span> <span class="o">=</span> <span class="nv">$twig</span><span class="o">-&gt;</span><span class="na">loadTemplate</span><span class="p">(</span><span class="nv">$template_file</span> <span class="o">.</span> <span class="s1">&#39;.html&#39;</span><span class="p">);</span> <span class="lineno">24</span> <span class="lineno">25</span> <span class="k">echo</span> <span class="nv">$template</span><span class="o">-&gt;</span><span class="na">render</span><span class="p">(</span><span class="nv">$bindings</span><span class="p">);</span> <span class="lineno">26</span> <span class="lineno">27</span> <span class="cp">?&gt;</span><span class="x"></span> </pre></div> <ol class="arabic simple"> <li>You are now ready to view your HTML pages. Go to your localhost URL which you'll find in Mac's System Preferences, Sharing, Web Sharing pane, and add <tt class="docutils literal"><span class="pre">loader.php?file=[html_filename]</span></tt> to the URL. So for example I got <tt class="docutils literal"><span class="pre"></span></tt>. That's it!</li> </ol> <div class="note"> <p class="first admonition-title">Note</p> <p class="last">To summarise my personal setup: Twig is in my <tt class="docutils literal">Sites</tt> foleder. The <tt class="docutils literal">Sites</tt> folder also contains a simlink to my project folder. My project folder containes both the <tt class="docutils literal">loader.php</tt>, the HTML template files, and the content files which inherit the template files. To run it the url is: <tt class="docutils literal">[path to Sites <span class="pre">folder]/[project</span> <span class="pre">folder]/loader.php?file=publication</span></tt>.</p> </div> </div> </div> <div class="section" id="pretty-urls"> <h3>Pretty URLs</h3> <p>Edit 14 May 2013: if you would like prettier URLs I can recommend using Apache htaccess. To get links like <tt class="docutils literal">/publication.html</tt> instead of <tt class="docutils literal"><span class="pre">/loader.php?file=publication</span></tt> <a class="reference external" href="">read my blog post to enable htaccess on the Mac</a> and add a <tt class="docutils literal">.htaccess</tt> file to your project root with the following contents:</p> <pre class="literal-block"> Options +FollowSymlinks RewriteEngine on RewriteRule ^(.*)\.html$ loader\.php?file=$1 [NC] </pre> </div> <div class="section" id="sources"> <h3>Sources</h3> <div class="section" id="php-apache"> <h4>PHP &amp; Apache</h4> <ul class="simple"> <li><a class="reference external" href="">Starting PHP and Apache on a Mac</a></li> <li><a class="reference external" href="">Simlinking from the Sites folder on a Mac</a></li> <li><a class="reference external" href="">PHP.ini</a></li> <li><a class="reference external" href="">Install Apache PHP MySQL on Mac OS X</a></li> <li><a class="reference external" href="">VHOSTS on Mac Leopard</a></li> <li><a class="reference external" href="">How to install Apache and PHP on a Mac OS X 10.8 MAMP part 1</a></li> </ul> </div> <div class="section" id="id1"> <h4>Twig</h4> <ul class="simple"> <li><a class="reference external" href="">Twig</a></li> <li><a class="reference external" href="">Setting up Twig</a></li> <li><a class="reference external" href="">Twig API</a></li> </ul> </div> </div> Fri, 17 Aug 2012 22:22:31 GMT,2012-08-17:/2012/quick-templating-system-html-page-mock-ups-mac-os- TinyMCE in one of multiple Textarea fields in Admin <p>When I was working with Django the other day I had a model which contained 3 textareas (<tt class="docutils literal">models.TextField()</tt>). I only wanted 2 of the 3 to use TinyMCE for mark-up in the Admin. I worked out how to achieve this and here’s a quick guide.</p> <ol class="arabic"> <li><p class="first">Install TinyMCE as explained in an earlier post.</p> </li> <li><p class="first">Make sure the tiny_mce folder, the one you downloaded from, is also in your site-media javascript folder <tt class="docutils literal"><span class="pre">(/[sitemedia]/js/tiny_mce/)</span></tt> or change <tt class="docutils literal">TINYMCE_JS_URL</tt> in your <tt class="docutils literal"></tt> to the correct folder.</p> </li> <li><p class="first">In your <tt class="docutils literal"></tt> define what you want the default tinymce to look like, for example:</p> <pre class="literal-block"> TINYMCE_DEFAULT_CONFIG = { 'plugins': &quot;safari, spellchecker, save, advlink, iespell, paste, xhtmlxtras,&quot;, 'theme': 'advanced', 'theme_advanced_buttons1': &quot;bold, italic, underline, strikethrough,|, justifyleft, justifycenter, justifyright, justifyfull,|, bullist, numlist,|, outdent, indent, blockquote,&quot;, 'theme_advanced_buttons2':&quot;undo, redo, |, link, unlink, anchor, cleanup, help, code, spellchecker&quot;, 'theme_advanced_buttons3':&quot;&quot;, 'theme_advanced_buttons4':&quot;&quot;, 'theme_advanced_toolbar_location' : &quot;top&quot;, 'theme_advanced_toolbar_align' : &quot;left&quot;, 'theme_advanced_statusbar_location' : &quot;bottom&quot;, 'theme_advanced_resizing' : 'true', } </pre> </li> <li><p class="first">In your model admin file add <tt class="docutils literal">from tinymce.widgets import TinyMCE</tt> and to the model’s admin class add:</p> <pre class="literal-block"> def formfield_for_dbfield(self, db_field, **kwargs): if == '[your_field_name]': # you can add more fields here by using 'or' kwargs['widget'] = TinyMCE(attrs={'cols':80, 'rows': 30}) try: del kwargs['request'] except KeyError: pass return db_field.formfield(**kwargs) return super([model_admin_class_name],self).formfield_for_dbfield(db_field, **kwargs) </pre> </li> </ol> <p>Edit 20 Oct. 2011: It should be noted that in the new version of TinyMCE only the English language file is included with the 'simple' and 'standard' themes. When you use <tt class="docutils literal"><span class="pre">'language':&quot;nl&quot;</span></tt> for example in your <tt class="docutils literal">TINYMCE_DEFAULT_CONFIG</tt> you should go to the TinyMCE website and get the required languages and put them in the correct folder (<tt class="docutils literal">tiny_mce/themes/simple/lang</tt> for example).</p> Mon, 21 Jun 2010 16:34:56 GMT,2010-06-21:/2010/tinymce-in-one-of-multiple-textareas TinyMCE in Django <p>A while ago when I was working with Django I had a really hard time trying to figure out how to get TinyMCE to work in Django. Now it isn't difficult, you just have to know how to do it. So I've written a quick guide on how to make it all work.</p> Wed, 21 Oct 2009 22:04:58 GMT,2009-10-21:/2009/tinymce-in-django