snipt

Ctrl+h for KB shortcuts

Python 3

Basic static Python with error

1
2
3
4
def f() -> None:
   x = 1 + 'a'

f()
https://snipt.net/embed/d188ea8494f2fa82df7809a1feda01fb/
https://snipt.net/raw/d188ea8494f2fa82df7809a1feda01fb/
d188ea8494f2fa82df7809a1feda01fb
python3
Python 3
4
2016-09-25T23:05:08
True
False
False
Jun 13, 2016 at 10:06 PM
/api/public/snipt/147191/
basic-static-python-with-error
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="k">def</span> <span class="nf">f</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="k">None</span><span class="p">:</span> </span><span id="L-2"><a name="L-2"></a> <span class="n">x</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">+</span> <span class="s">&#39;a&#39;</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="n">f</span><span class="p">()</span> </span></pre></div> </td></tr></table>
python, static

Bash

Force static page load

1
2
3
# rbanh: force static page load.
# bypass index.php for wordpress, ee, etc.
RewriteRule ^bookaroom$ - [PT,L]
https://snipt.net/embed/327158855b2f8962fe989677ff8891a6/
https://snipt.net/raw/327158855b2f8962fe989677ff8891a6/
327158855b2f8962fe989677ff8891a6
bash
Bash
3
2016-09-24T00:18:54
True
False
False
/api/public/snipt/39154/
force-static-page-load
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="c"># rbanh: force static page load.</span> </span><span id="L-2"><a name="L-2"></a><span class="c"># bypass index.php for wordpress, ee, etc.</span> </span><span id="L-3"><a name="L-3"></a>RewriteRule ^bookaroom<span class="nv">$ </span>- <span class="o">[</span>PT,L<span class="o">]</span> </span></pre></div> </td></tr></table>
htaccess, static

Python

serve media_url in dev for django

1
2
3
4
5
6
7
8
from django.conf.urls.defaults import *
from django.conf import settings

if settings.DEBUG:
    urlpatterns += patterns('django.views.static',
        (r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:], 'serve',
        {'document_root': settings.MEDIA_ROOT}),
    )
https://snipt.net/embed/104c8b7a1dc9f37a28a69d7a4d246fdd/
https://snipt.net/raw/104c8b7a1dc9f37a28a69d7a4d246fdd/
104c8b7a1dc9f37a28a69d7a4d246fdd
python
Python
8
2016-09-27T10:22:21
True
False
False
/api/public/snipt/28103/
serve-media_url-in-dev-for-django
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="kn">from</span> <span class="nn">django.conf.urls.defaults</span> <span class="kn">import</span> <span class="o">*</span> </span><span id="L-2"><a name="L-2"></a><span class="kn">from</span> <span class="nn">django.conf</span> <span class="kn">import</span> <span class="n">settings</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">DEBUG</span><span class="p">:</span> </span><span id="L-5"><a name="L-5"></a> <span class="n">urlpatterns</span> <span class="o">+=</span> <span class="n">patterns</span><span class="p">(</span><span class="s">&#39;django.views.static&#39;</span><span class="p">,</span> </span><span id="L-6"><a name="L-6"></a> <span class="p">(</span><span class="s">r&#39;^</span><span class="si">%s</span><span class="s">(?P&lt;path&gt;.*)$&#39;</span> <span class="o">%</span> <span class="n">settings</span><span class="o">.</span><span class="n">MEDIA_URL</span><span class="p">[</span><span class="mi">1</span><span class="p">:],</span> <span class="s">&#39;serve&#39;</span><span class="p">,</span> </span><span id="L-7"><a name="L-7"></a> <span class="p">{</span><span class="s">&#39;document_root&#39;</span><span class="p">:</span> <span class="n">settings</span><span class="o">.</span><span class="n">MEDIA_ROOT</span><span class="p">}),</span> </span><span id="L-8"><a name="L-8"></a> <span class="p">)</span> </span></pre></div> </td></tr></table>
django, static
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.