Skip to content

Commit 5241072

Browse files
committed
add new vim and why use python resources
1 parent 05ee1fe commit 5241072

File tree

7 files changed

+71
-2
lines changed

7 files changed

+71
-2
lines changed

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ run:
33
cp -R static-html/* generated/updated_site/
44
cp -R redirects/* generated/updated_site/
55
cp -R static/* generated/updated_site/
6+
sed -i '' 's/\(^.*~~.*$$\)/<span class="highlight">\1<\/span>/g' generated/updated_site/pages/*.html
7+
sed -i '' 's/~~//g' generated/updated_site/pages/*.html
68
cp generated/updated_site/pages/* generated/updated_site/
79
rm -rf generated/updated_site/pages/
810
sed -i '' 's/\(^.*~~.*$$\)/<span class="highlight">\1<\/span>/g' generated/updated_site/blog/*.html

content/pages/01-introduction/03-why-use-python.markdown

+4
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ language.
142142
introduced to the language and ecosystem while getting data analysis
143143
work done.
144144

145+
* [Evangelizing Python for Business](https://pbpython.com/python-for-business.html)
146+
contains helpful hints if you are trying to convince your company to use
147+
Python, particularly for [web development](/web-development.html).
148+
145149
* [Python: Beyond Just Web Apps](https://blog.appdynamics.com/python/python-beyond-just-web-apps/)
146150
supplies non-web development project examples that use Python. The article
147151
also does a solid job comparing and contrasting Python to other common

content/pages/02-development-environments/02-vim.markdown

+4
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ to get started with these tutorials.
133133
the same path I've found myself taking as I approach my own ten year
134134
mark with Vim.
135135

136+
* [At least one Vim trick you might not know about](https://www.hillelwayne.com/post/intermediate-vim/)
137+
is a collection of non-obvious keyboard shortcuts, many of which are
138+
infrequently used but still useful.
139+
136140
* [Vim Adventures](http://vim-adventures.com/) is a cute, fun browser-based
137141
game that helps you learn Vim commands by playing through the adventure.
138142

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
title: django.urls.path Examples
2+
category: page
3+
slug: django-urls-path
4+
sortorder: 5000
5+
toc: False
6+
sidebartitle: django.urls.path Examples
7+
meta: Python code examples for the path function within the django.urls module of the Django project.
8+
9+
10+
# django.urls.path Examples
11+
The [path](https://github.com/django/django/blob/master/django/urls/conf.py) function
12+
is contained with the
13+
[django.urls](https://github.com/django/django/tree/master/django/urls) module within
14+
the [Django project](/django.html) code base.
15+
16+
17+
## Example 1 from gadget-board
18+
[gadget-board](https://github.com/mik4el/gadget-board) is a [Django](/django.html),
19+
[Django REST Framework (DRF)](/django-rest-framework-drf.html) and
20+
[Angular](/angular.html) web application that is open source under the
21+
[Apache2 license](https://github.com/mik4el/gadget-board/blob/master/LICENSE).
22+
23+
[**gadget-board/web/gadget_board_backend/urls.py**](https://github.com/mik4el/gadget-board/blob/master/web/gadget_board_backend/urls.py)
24+
25+
```python
26+
from django.conf.urls import url, include
27+
from django.contrib import admin
28+
from rest_framework_nested import routers
29+
from rest_framework_jwt.views import obtain_jwt_token
30+
from rest_framework_jwt.views import refresh_jwt_token
31+
32+
from authentication.views import AccountViewSet
33+
from gadgets.views import GadgetViewSet, GadgetDataViewSet
34+
35+
router = routers.SimpleRouter()
36+
router.register(r'accounts', AccountViewSet)
37+
router.register(r'gadgets', GadgetViewSet)
38+
gadgets_router = routers.NestedSimpleRouter(router, r'gadgets', lookup='gadget')
39+
gadgets_router.register(r'data', GadgetDataViewSet, base_name='gadgets-data')
40+
41+
urlpatterns = [
42+
~~ url(r'^backend/admin/', admin.site.urls),
43+
url(r'^backend/api-auth/', include('rest_framework.urls', namespace='rest_framework')),
44+
url(r'^backend/api-token-auth/', obtain_jwt_token),
45+
url(r'^backend/api-token-refresh/', refresh_jwt_token),
46+
url(r'^backend/api/v1/', include(router.urls)),
47+
url(r'^backend/api/v1/', include(gadgets_router.urls)),
48+
]
49+
```
50+
51+

settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
GITHUB_URL = 'https://github.com/mattmakai/fullstackpython.com'
88
PDF_GENERATOR = False
99
DIRECT_TEMPLATES = ('index', 'sitemap', 'table-of-contents', 'email',
10-
'blog', 'all',) #'pdf-book', 'epub-book')
10+
'blog', 'example', 'all',) #'pdf-book', 'epub-book')
1111

1212
ARTICLE_SAVE_AS = 'blog/{slug}.html'
1313
ARTICLE_URL = 'blog/{slug}.html'

theme/templates/example.html

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{% block content %}
2+
{% if page %}
3+
<h1>Code Examples for {{ page.title }}</h1>
4+
5+
{% endif %}
6+
{% endblock %}

theme/templates/page.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
{% else %}
4444
{{ page.content }}
4545
{% endif %}
46-
{% include "choices/" + page.slug + ".html" %}
46+
{% if not page.sortorder == "5000" %}
47+
{% include "choices/" + page.slug + ".html" %}
48+
{% endif %}
4749
{% include "email-for-book.html" %}
4850
</div>
4951
<div class="co1 c3" id="sb">

0 commit comments

Comments
 (0)