-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintroduction.html
More file actions
433 lines (376 loc) · 22.8 KB
/
introduction.html
File metadata and controls
433 lines (376 loc) · 22.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
<!DOCTYPE html>
<html lang="en">
<head>
<title>Navycut - The Fullstack web framework to meet the developers expectation.</title>
<!-- Meta -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Bootstrap 4 Template For Software Startups">
<meta name="author" content="Xiaoying Riley at 3rd Wave Media">
<link rel="shortcut icon" href="icons/favicon.ico">
<!-- Google Font -->
<link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700&display=swap" rel="stylesheet">
<!-- FontAwesome JS-->
<script defer src="assets/fontawesome/js/all.min.js"></script>
<!-- Plugins CSS -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.2/styles/atom-one-dark.min.css">
<!-- Theme CSS -->
<link id="theme-style" rel="stylesheet" href="assets/css/theme.css">
<!-- custom css -->
<link rel="stylesheet" href="assets/css/custom.css">
</head>
<body class="docs-page">
<header class="header fixed-top">
<div class="branding docs-branding">
<div class="container-fluid position-relative py-2">
<div class="docs-logo-wrapper">
<button id="docs-sidebar-toggler" class="docs-sidebar-toggler docs-sidebar-visible mr-2 d-xl-none" type="button">
<span></span>
<span></span>
<span></span>
</button>
<div class="site-logo"><a class="navbar-brand" href="index.html"><img class="logo-icon mr-2 logo_image" src="icons/apple-touch-icon.png" alt="logo"><span class="logo-text">Navy<span class="text-alt">cut</span></span></a></div>
</div><!--//docs-logo-wrapper-->
<div class="docs-top-utilities d-flex justify-content-end align-items-center">
<div class="top-search-box d-none d-lg-flex">
<form class="search-form">
<input type="text" placeholder="Search the docs..." name="search" class="form-control search-input">
<button type="submit" class="btn search-btn" value="Search"><i class="fas fa-search"></i></button>
</form>
</div>
<ul class="social-list list-inline mx-md-3 mx-lg-5 mb-0 d-none d-lg-flex">
<li class="list-inline-item"><a href="https://github.com/navycut/navycut"><i class="fab fa-github fa-fw"></i></a></li>
<li class="list-inline-item"><a href="https://pypi.org/project/navycut"><i class="fab fa-python fa-fw"></i></a></li>
<!-- <li class="list-inline-item"><a href="#"><i class="fab fa-slack fa-fw"></i></a></li>
<li class="list-inline-item"><a href="#"><i class="fab fa-product-hunt fa-fw"></i></a></li> -->
</ul><!--//social-list-->
<!-- <a href="https://themes.3rdwavemedia.com/bootstrap-templates/startup/coderdocs-free-bootstrap-4-documentation-template-for-software-projects/" class="btn btn-primary d-none d-lg-flex">Download</a> -->
</div><!--//docs-top-utilities-->
</div><!--//container-->
</div><!--//branding-->
</header><!--//header-->
<div class="docs-wrapper">
<div id="docs-sidebar" class="docs-sidebar">
<div class="top-search-box d-lg-none p-3">
<form class="search-form">
<input type="text" placeholder="Search the docs..." name="search" class="form-control search-input">
<button type="submit" class="btn search-btn" value="Search"><i class="fas fa-search"></i></button>
</form>
</div>
<nav id="docs-nav" class="docs-nav navbar">
<ul class="section-items list-unstyled nav flex-column pb-3">
<li class="nav-item section-title"><a class="nav-link scrollto active" href="#section-1"><span class="theme-icon-holder mr-2"><i class="fas fa-map-signs"></i></span>Overview</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-1-1">Why Navycut</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-1-2">Fullstack Support</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-1-3">Ridiculously Fast</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-1-4">Fully Loaded</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-1-5">Reassuringly secure.</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-1-6">Incredibly versatile.</a></li>
<li class="nav-item section-title mt-3"><a class="nav-link scrollto" href="#section-2"><span class="theme-icon-holder mr-2"><i class="fas fa-arrow-down"></i></span>Installation</a></li>
<li class="nav-item section-title mt-3"><a class="nav-link scrollto" href="#section-3"><span class="theme-icon-holder mr-2"><i class="fas fa-box"></i></span>Intro To Navycut</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-3-1">Object relational mapper</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-3-2">Urls and Views</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-3-3">Templates</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-3-4">Forms</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-3-5">Authentication</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-3-6">Admin</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-3-7">Internationalization</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-3-8">Security</a></li>
<!-- <li class="nav-item section-title mt-3"><a class="nav-link scrollto" href="#section-4"><span class="theme-icon-holder mr-2"><i class="fas fa-cogs"></i></span>Documentation</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-4-1">The Model Layer</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-4-2">The View layer</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-4-3">The Template Layer</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-4-4">The Admin</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-4-5">The common web application tools</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-4-6">Security</a></li>
<li class="nav-item section-title mt-3"><a class="nav-link scrollto" href="#section-5"><span class="theme-icon-holder mr-2"><i class="fas fa-tools"></i></span>Utilities</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-5-1">Section Item 5.1</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-5-2">Section Item 5.2</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-5-3">Section Item 5.3</a></li>
<li class="nav-item section-title mt-3"><a class="nav-link scrollto" href="#section-6"><span class="theme-icon-holder mr-2"><i class="fas fa-laptop-code"></i></span>Web</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-6-1">Section Item 6.1</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-6-2">Section Item 6.2</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-6-3">Section Item 6.3</a></li>
<li class="nav-item section-title mt-3"><a class="nav-link scrollto" href="#section-7"><span class="theme-icon-holder mr-2"><i class="fas fa-tablet-alt"></i></span>Mobile</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-7-1">Section Item 7.1</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-7-2">Section Item 7.2</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-7-3">Section Item 7.3</a></li>
<li class="nav-item section-title mt-3"><a class="nav-link scrollto" href="#section-8"><span class="theme-icon-holder mr-2"><i class="fas fa-book-reader"></i></span>Resources</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-8-1">Section Item 8.1</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-8-2">Section Item 8.2</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-8-3">Section Item 8.3</a></li>
<li class="nav-item section-title mt-3"><a class="nav-link scrollto" href="#section-9"><span class="theme-icon-holder mr-2"><i class="fas fa-lightbulb"></i></span>FAQs</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-9-1">Section Item 9.1</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-9-2">Section Item 9.2</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-9-3">Section Item 9.3</a></li> -->
</ul>
</nav><!--//docs-nav-->
</div><!--//docs-sidebar-->
<div class="docs-content">
<div class="container">
<article class="docs-article" id="section-1">
<header class="docs-header">
<h1 class="docs-heading">Overview <span class="docs-time">Last updated: 2021-06-13</span></h1>
<section class="docs-intro">
<p>With Navycut, you can take Web applications from concept to launch in a matter of hours. Navycut takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.</p>
</section>
</header>
<section class="docs-section" id="item-1-1">
<h2 class="section-heading">Why Navycut</h2>
<p>Navycut provides the Flask based fullstack web development platform to create an interactive website instantly.</p>
</section>
<section class="docs-section" id="item-1-2">
<h2 class="section-heading">Fullstack Support</h2>
<p>Navycut has the Flask based backend system as well as the Jinja2 Based template rendering system to design the frontend.</p>
</section><!--//section-->
<section class="docs-section" id="item-1-3">
<h2 class="section-heading">Ridiculously Fast</h2>
<p>Navycut was designed to help developers take applications from concept to completion as quickly as possible.</p>
</section><!--//section-->
<section class="docs-section" id="item-1-4">
<h2 class="section-heading">Fully Loaded</h2>
<p>Navycut includes dozens of extras you can use to handle common Web development tasks. Navycut takes care of user authentication, content administration, site maps, RSS feeds, and many more tasks — right out of the box.</p>
</section>
<section class="docs-section" id="item-1-5">
<h2 class="section-heading">Reassuringly Secure</h2>
<p>Navycut takes security seriously and helps developers avoid many common security mistakes, such as SQL injection, cross-site scripting, cross-site request forgery and clickjacking. Its user authentication system provides a secure way to manage user accounts and passwords.</p>
</section>
<section class="docs-section" id="item-1-6">
<h2 class="section-heading">Incredibly Versatile</h2>
<p>Companies, organizations and governments have used Django to build all sorts of things — from content management systems to social networks to scientific computing platforms.</p>
</section>
</article>
<article class="docs-article" id="section-2">
<header class="docs-header">
<h1 class="docs-heading">Installation</h1>
<section class="docs-intro">
<p>Being a Python Web framework, Python requires Python. You must need to use Python version 3.6 or later. Python includes a lightweight database called SQLite so you won’t need to set up a database just yet.
Get the latest version of Python at <a href="https://www.python.org/downloads/">https://www.python.org/downloads/</a> or with your operating system’s package manager.
You can verify that Python is installed by typing python from your shell;</br> you should see something like:</p>
<div class="docs-code-block">
<pre class="shadow-lg rounded">
<code class="python hljs">
Python 3.x.y
[GCC 4.x] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
</code>
</pre>
</div>
<p><strong>Install navycut from pypi using pip: </strong></p>
<div class="docs-code-block">
<pre class="shadow-lg rounded">
<code class="python hljs">
pip install -U navycut
</code>
</pre>
</div>
<p><strong>Install navycut from source code: </strong></p>
<div class="docs-code-block">
<pre class="shadow-lg rounded">
<code class="python hljs">
git clone https://github.com/navycut/navycut.git
cd navycut
python setup.py install
</code>
</pre>
</div>
<p><strong>To verify that Navycut can be seen by Python, type python from your shell. Then at the Python prompt, try to import navycut:</strong></p>
<div class="docs-code-block">
<pre class="shadow-lg rounded">
<code class="python hljs">
>>> import navycut
>>> print(navycut.get_version())
1.0.0
</code>
</pre>
</div>
</section><!--//docs-intro-->
</header>
</article><!--//docs-article-->
<article class="docs-article" id="section-3">
<header class="docs-header">
<h1 class="docs-heading">Intro to Navycut</h1>
<section class="docs-intro">
<p>The basic introduction about the stack and features of Navyvut project.</p>
</section>
</header>
<section class="docs-section" id="item-3-1">
<h2 class="section-heading">Object relational mapper</h2>
<p>Define your data models entirely in Python using SQLAlchemy. You get a rich, dynamic database-access API for free — but you can still write SQL if needed.</p>
<div class="docs-code-block">
<pre class="shadow-lg rounded">
<code class="python hljs">
from navycut.orm import sql
class Band(sql.Model):
"""A model of a rock band."""
id = sql.fields.Integer(pk=True)
name = sql.fields.Char(max_length=200)
can_rock = sql.fields.Boolean(default=True)
class Member(sql.Model):
"""A model of a rock band member."""
id = sql.fields.Integer(pk=True)
name = sql.fields.Char(help_text="Member's name", max_length=200)
instrument = sql.fields.Char(choices=(
('g', "Guitar"),
('b', "Bass"),
('d', "Drums"),
),
max_length=1
)
band = sql.fields.ForeignKey("Band")
</code>
</pre>
</div>
</section><!--//section-->
<section class="docs-section" id="item-3-2">
<h2 class="section-heading">Urls and Views</h2>
<p>A clean, elegant URL scheme is an important detail in a high-quality Web application. Navycut encourages beautiful URL design and doesn’t put any cruft in URLs, like .php or .asp.
To design URLs for an application, you create a Python module called a URLconf. Like a table of contents for your app, it contains a simple mapping between URL patterns and your views.</p>
<div class="docs-code-block">
<pre class="shadow-lg rounded">
<code class="python hljs">
from navycut.urls import path, url, include
from . import views
"""
The default url_prefix is the app name i.e "/band" for this case.
If you want to change it and use your own customized name then
plese update the url_prefix for a particular app on the sister.py file
under the AppSister class.
"""
urlpatterns = [
path('/', views.BandView, name='band-list'),
url('/<int:id>', views.band_detail, name='band-detail'),
url('/search/?id=1', views.band_search, name='band-search'),
include('/polls', 'polls.urls') # include urlpatterns from another app
]
</code>
</pre>
</div>
<div class="docs-code-block">
<pre class="shadow-lg rounded">
<code class="python hljs">
from navycut.urls import MethodView
from .models import Band
class BandView(MethodView):
def get(self):
bands = Band.query.all()
return self.render('bands/band_listing.html', {'bands': bands})
def band_details(req, res, id):
band = Band.query.get(id)
return res.json(band)
def band_search(req, res):
id = int(req.args.get('id'))
band = Band.query.get(id)
return res.json(band)
</code>
</pre>
</div>
</section><!--//section-->
<section class="docs-section" id="item-3-3">
<h2 class="section-heading">Templates</h2>
<p>Navycut's template language(Jinja2) is designed to strike a balance between power and ease. It’s designed to feel comfortable and easy-to-learn to those used to working with HTML, like designers and front-end developers. But it is also flexible and highly extensible, allowing developers to augment the template language as needed.</p>
<div class="docs-code-block">
<script src="https://gist.github.com/marktennyson/fd2c00691f2282a604252cb8a2aff9b2.js"></script>
</div>
</section>
<section class="docs-section" id="item-3-4">
<h2 class="section-heading">Forms</h2>
<p>Navycut provides a powerful form library using wt-form that handles rendering forms as HTML, validating user-submitted data, and converting that data to native Python types. Navycut also provides a way to generate forms from your existing models and use those forms to create and update data.</p>
<div class="docs-code-block">
<pre class="shadow-lg rounded">
<code class="python hljs">
from navycut.contrib import forms
class RegistrationForm(forms.Form):
username = forms.StringField('Username', [forms.validators.Length(min=4, max=25)])
email = forms.StringField('Email Address', [forms.validators.Length(min=6, max=35)])
password = forms.PasswordField('New Password', [
forms.validators.DataRequired(),
forms.validators.EqualTo('confirm', message='Passwords must match')
])
confirm = forms.PasswordField('Repeat Password')
accept_tos = forms.BooleanField('I accept the TOS', [forms.validators.DataRequired()])
</code>
</pre>
</div>
</section>
<section class="docs-section" id="item-3-5">
<h2 class="section-heading">Authentication</h2>
<p>Navycut comes with a full-featured and secure authentication system. It handles user accounts, groups, permissions and cookie-based user sessions. This lets you easily build sites that allow users to create accounts and safely log in/out.</p>
<div class="docs-code-block">
<pre class="shadow-lg rounded">
<code class="python hljs">
from navycut.auth import login_required, current_user
from navycut.http import JsonResponse
from navycut.urls import MethodView
class AuthView(MethodView):
@login_required
def get(self):
return JsonResponse(logged_in_username=current_user.username)
</code>
</pre>
</div>
</section>
<section class="docs-section" id="item-3-6">
<h2 class="section-heading">Admin</h2>
<p>One of the most powerful parts of Navycut is its automatic admin interface. It reads metadata in your models to provide a powerful and production-ready interface that content producers can immediately use to start managing content on your site. It’s easy to set up and provides many hooks for customization. Basically Navycut uses the default flask_admin module to provide this service.</p>
<div class="docs-code-block">
<pre class="shadow-lg rounded">
<code class="python hljs">
from navycut.admin import admin
from navycut.admin.site.views import NCAdminModelView
from .models import Band, Member
class MemberAdminModelView(NCAdminModelView):
"""Customize the look of the auto-generated admin for the Member model"""
excluded_fields = ['name',]
admin.register_model(Band) # Use the default options
admin.register_model(Member, MemberAdminModelView) # Use the customized options
</code>
</pre>
</div>
</section>
<section class="docs-section" id="item-3-7">
<h2 class="section-heading">Internationalization</h2>
<p>no service till yet. need to develop.</p>
</section>
<section class="docs-section" id="item-3-8">
<h2 class="section-heading">Security</h2>
<p>Navycut provides multiple protections against:
<li>Clickjacking</li>
<li>Cross-site scripting</li>
<li>Cross Site Request Forgery (CSRF)</li>
<li>SQL injection</li>
<li>Remote code execution</li>
</p>
</section>
</article><!--//docs-article-->
<footer class="footer">
<div class="container text-center py-5">
<!--/* This template is free as long as you keep the footer attribution link. If you'd like to use the template without the attribution link, you can buy the commercial license via our website: themes.3rdwavemedia.com Thank you for your support. :) */-->
<!-- <small class="copyright">Designed with <i class="fas fa-heart" style="color: #fb866a;"></i> by <a class="theme-link" href="http://themes.3rdwavemedia.com" target="_blank">Xiaoying Riley</a> for developers</small> -->
<ul class="social-list list-unstyled pt-4 mb-0">
<li class="list-inline-item"><a href="https://github.com/navycut/navycut"><i class="fab fa-github fa-fw"></i></a></li>
<!-- <li class="list-inline-item"><a href="#"><i class="fab fa-twitter fa-fw"></i></a></li>
<li class="list-inline-item"><a href="#"><i class="fab fa-slack fa-fw"></i></a></li>
<li class="list-inline-item"><a href="#"><i class="fab fa-product-hunt fa-fw"></i></a></li>
<li class="list-inline-item"><a href="#"><i class="fab fa-facebook-f fa-fw"></i></a></li> -->
<li class="list-inline-item"><a href="https://pypi.org/project/navycut"><i class="fab fa-python fa-fw"></i></a></li>
</ul><!--//social-list-->
</div>
</footer>
</div>
</div>
</div><!--//docs-wrapper-->
<!-- Javascript -->
<script src="assets/plugins/jquery-3.4.1.min.js"></script>
<script src="assets/plugins/popper.min.js"></script>
<script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<!-- Page Specific JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.8/highlight.min.js"></script>
<script src="assets/js/highlight-custom.js"></script>
<script src="assets/plugins/jquery.scrollTo.min.js"></script>
<script src="assets/plugins/lightbox/dist/ekko-lightbox.min.js"></script>
<script src="assets/js/docs.js"></script>
</body>
</html>