-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript-python.html
More file actions
517 lines (462 loc) · 30 KB
/
javascript-python.html
File metadata and controls
517 lines (462 loc) · 30 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
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta http-equiv="Cache-control" content="no-cache">
<link rel="icon" href="../img/favicon.png">
<title>FUNdamentals to Coding - About what I am learning?</title>
<meta name="description" content="As a Web Developer and Code Instructor, I have designed 2-hour online courses where you’ll learn to code HTML/CSS and Bootstrap using online tools and resources to build and deploy a website and website maintenance.">
<meta name="author" content="Judith Desire, info@redesigningtech.com">
<meta name="keywords" content="judith desire, senior presentation coder, ux ui, web development, front end development, html, css, bootcamp, web maintenance, quality assurance, tutor, tutoring, online training, remote learning, online learning, code instructor">
<meta name="robots" content="noarchive">
<!-- Social Media META Tags -->
<meta property="og:title" content="FUNdamentals to Coding - Learn with a Code Instructor">
<meta property="og:description" content="Providing in-person or virtually learning to learn Introduction to HTML, Beginner to Intermidate CSS3, Introduction to Bootstrap and Beginner to Advance Quality Assurance for Web Maintenance">
<meta property="og:type" content="website" />
<meta property="og:image" content="https://berryny.github.io/cafe-tech/img/adult-on-devices.jpg">
<meta property="og:url" content="https://berryny.github.io/cafe-tech/index.html">
<meta name="twitter:card" content="summary_large_image">
<meta property="og:site_name" content="FUNdamentals to Coding - Learn with a Code Instructor">
<meta property="og:site_name" content="Learn with a Code Instructor online or in-person">
<meta name="twitter:image:alt" content="One-on-One FUNdamentals to Coding Learning on desktop, laptop and portable devices">
<meta name="twitter:site" content="@judidesire">
<link rel="image_src" href="https://berryny.github.io/cafe-tech/img/adult-on-devices.jpg" />
<link rel="preload" href="../css/main.css" as="style">
<link rel="stylesheet" href="../css/main.css">
</head>
<body>
<header class="header position-relative">
<nav class="navbar navbar-expand-md navbar-light px-3 position-absolute w-100 custom-navigation">
<a class="navbar-brand" href="../">
<img src="../img/logo-cafetech.png" width="50" height="" class="d-inline-block align-top logo" alt="Grid Layout">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-between pl-5" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="../index.html">Home</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="#about">About <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Learn
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<h6 class="text-center border-bottom">ONE-ON-ONE LEARNING</h6>
<a class="dropdown-item" href="../learn/learn-html.html">Introduction to HTML</a>
<a class="dropdown-item" href="../learn/learn-html-css.html">Foundation of CSS</a>
<a class="dropdown-item" href="../learn/learn-bootstrap.html">Using Bootstrap</a>
<a class="dropdown-item" href="../learn/website-quality-assurance.html">Quality Assurance (QA)</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="#contactus">Contact Us</a>
</li>
</ul>
<ul class="list-inline icons-social-media m-0">
<li class="list-inline-item"><a href="https://github.com/berryny" target="_blank"><i class="fab fa-github"></i></a></li>
<li class="list-inline-item"><a href="https://www.linkedin.com/in/jdesire/" target="_blank"><i class="fab fa-linkedin-in"></i></a></li>
<li class="list-inline-item"><a href="mailto:info@redesigningtech.com"><i class="fas fa-envelope"></i></a></li>
</ul>
</div>
</nav>
</header>
<main class="main">
<div class="jumbotron jumbotron-fluid bg-parallax custom-secondary custom-jumbotron p-0 m-0">
<div class="custom-jumbotron-container text-center d-flex flex-column justify-content-center w-100">
<h1 class="display-3 fadeInUp">Learning</h1>
<h2 class="display-5 fadeIn delay-1s text-monospace">JavaScript & Python</h2>
<h4 class="display-5 fadeIn delay-1s text-monospace">This page describes the learning process from beginning to end!</h4>
<ul class="list-inline mt-5">
<li class="list-inline-item fadeIn delay-2s"><a class="btn btn-outline-warning btn-lg" href="../docs/Judith_Desire_Resume.pdf" role="button">Download Resume</a></li>
</ul>
</div>
</div>
<div class="container-fluid p-0 mt-5" id="coding-project">
<div class="container">
<div class="row d-flex align-items-start">
<div class="col-md">
<h3 class="display-4">prep</h3>
<ol>
<li><p><a href="https://www.python.org/downloads/" target="_blank" rel="nofollow">Download</a> Python <br>Python is a free programming language that lets you easily integrate and analysis data effectively.</p></li>
<li><p><a href="https://pip.pypa.io/en/stable/installing/" target="_blank" rel="nofollow">install pip</a> <br>Pip is a package management system (command tool) used to install and manage software packages for Python packages.</p></li>
<li><p><a href="https://www.postman.com/downloads/" target="_blank" rel="nofollow">Download</a> Postman App a free collaboration platform for API development.</p></li>
<li><p><a href="https://virtualenv.pypa.io/en/latest/" target="_blank" rel="nofollow">virtualenv</a> a tool to create isolated Python environments.</p></li>
<li><p><a href="https://flask.palletsprojects.com/en/1.1.x/installation/#installation" target="_blank" rel="nofollow">Flask </a> <br>A web framework written in Python used as a template engine for web development.</p></li>
<li><p><a href="https://www.sublimetext.com/" target="_blank" rel="nofollow">Download</a> Sublime Text Editor a sophisticated text editor for code, markup and prose.</p></li>
</ol>
</div>
<div class="col-md">
<h3 class="display-4">alternative</h3>
<ul class="list-unstyled">
<li><p><a href="https://jupyter.org/" target="_blank" rel="nofollow">Jupyter</a> develop open-source software, open-standards, and services for interactive computing across dozens of programming languages.</p></li>
<li><p><a href="https://colab.research.google.com/" target="_blank" rel="nofollow">Google Colab</a> to execute Python using a browser (Saas)</p></li>
</ul>
<p>Have an understanding of coding and basic knowledge of Javascript, Python and Bootstrap</p>
<h3 class="display-4">resources</h3>
<ul class="list-unstyled">
<li><p><a href="../learn/learn-bootstrap.html" target="_blank">Learn Bootstrap</a></p></li>
<li><p><a href="https://github.com/aneagoie/ztm-python-cheat-sheet" target="_blank" rel="nofollow">Python ZTM Cheatsheet</a></p></li>
<li><p><a href="https://jinja.palletsprojects.com/en/2.11.x/" rel="nofollow" target="_blank">Jinja</a> is a modern and designer-friendly templating language for Python</p></li>
<li><p><a href="https://flask.palletsprojects.com/en/1.1.x/quickstart/" rel="nofollow" target="_blank">Flask Quickstart Doc</a></p></li>
<li><p><a href="https://flask.palletsprojects.com/en/1.1.x/quickstart/#rendering-templates" rel="nofollow" target="_blank">Flask Rendering Templates</a></p></li>
<li><p><a href="https://flask.palletsprojects.com/en/1.1.x/deploying/wsgi-standalone/" target="_blank" rel="nofollow">Gunicorn [Green Unicorn]</a> is a WSGI [Web Server Gateway Interface] HTTP Server for UNIX. WSGI is a protocol for Python applications in ordeer to serve websites in a uniform matter.</p></li>
<li><p><a href="https://github.com/pypa/pipenv" target="_blank" rel="nofollow">Pipenv</a> is a tool that brings packaging tools for Python. <br>You no longer need to use <code>pip</code> and <code>virtualenv</code> separately. They work together.</p></li>
<li><p><a href="https://support.apple.com/guide/terminal/use-command-line-text-editors-apdb02f1133-25af-4c65-8976-159609f99817/mac" target="_blank" rel="nofollow">Nano</a> <code>nano</code> is a simple command-line editor. See the <a href="x-man-page://nano">nano man page</a>.</p></li>
<li><p><a href="https://help.krystal.uk/python/creating-a-python-app-using-the-flask-framework" target="_blank" rel="nofollow">Creating a Python App using the Flask framework</a></p></li>
</ul>
</div>
</div>
<div class="container">
<h3 class="display-4 text-center">setup</h3>
<div class="row">
<div class="col-lg">
<h4 class="display-5">Python</h4>
<ul class="list-unstyled">
<li><p>Open terminal (Mac) or command prompt (PC) > Type <br><code>python</code> or <code>py</code> for version 2.7 or <code>python3</code> for version 3 and <em>click enter/return</em></p></li>
<li><p><mark>Error message indicates you don't have Python installed</mark><br>
<a href="https://www.python.org/downloads/" target="_blank" rel="nofollow">Click</a> to download & install</p></li>
<li><p><mark>Success!</mark> type <code>exit()</code> and <em>click enter/return</em> or keyboard command <code>CTRL + D</code></p></li>
</ul>
</div>
<div class="col-lg">
<h4 class="display-5">pip</h4>
<ul>
<li>Installation
<p>Open terminal (Mac) or command prompt (PC) > Type <br><code>pip</code> or <code>pip --version</code> and <em>click enter/return</em> <br><br>
<mark>Error message indicates you don't have pip installed</mark><br>
After installing Python, install pip with <b>get-pip.py</b> <br>
Open terminal (Mac) or command prompt (PC) > Type <br>
<code>curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py</code> and <em>click enter/return</em><br>
<code>python get-pip.py</code> and <em>click enter/return</em></p>
<p><mark>Success!</mark> version appeared</p>
</li>
<li>pip Packages
<p>Type <code>pip list</code> and <em>click enter/return</em> search for <em>virtualenv</em> <br><br>
<mark>Error</mark> > Type <code>sudo pip install virtualenv</code> (sudo allows install permission on Mac)</p>
<p><mark>Success!</mark> virtualenv appear in the list</p>
</li>
<li>pip install Flask
<p>Type <code>pip list</code> and <em>click enter/return</em> search for <em>Flask</em> <br><br>
<mark>Error</mark> > Type <br><code>sudo pip install flask</code></p>
<p><mark>Success!</mark> Flask appear in the list</p>
</li>
</ul>
</div>
</div>
</div>
<div class="col-12">
<h3 class="display-4 text-center">project coding</h3>
<h5 class="display-6">directory</h5>
<p>Create the project folder on the computer <br>
<h5 class="display-6">editor</h5>
<p>Execute Sublime > Click <b>File</b> > <b>Open</b> > Navigate and Select the project folder</p>
<p>Right click on folder > Select <b>New File</b> > save and name file <code>index.py</code></p>
<div class="my-2 bg-dark rounded-lg">
<pre class="p-3">
<code class="text-white">
<span class="highlight-marker">print("Oh Hi!")</span>
# prompt user to type name at the command line
name = input()
# returned input to render {name}
# f-strings are a great new way to format strings. (new feature in 3)
<span class="highlight-marker">print(f"Oh Hi, {name}!")</span>
</code>
</pre>
</div>
</ul>
<h5 class="display-6">command</h5>
<p>Open terminal (Mac) or command prompt (PC) > Type <code>cd /path/to/directory</code> and <em>click enter/return</em> <br>
Type > <code>python3 index.py</code>
</p>
</div>
<div id="install-flax" class="container">
<h3 class="display-4 text-center">Flask</h3>
<p>Flask focus on what users are requesting and how to return back a responce to the user based on the request made.</p>
<p>Right click on the project folder > Select <b>New File</b> > save and name file <code>app.py</code></p>
<div class="my-2 bg-dark rounded-lg">
<pre class="p-3">
<code class="text-white">
from flask import Flask
# create an application which is called Flask
app = Flask(__name__)
# flask is designed by routes
# / represents the default page (index.html)
@app.route("/")
# the function to run at / route
def index():
return "Welcome to Coding"
@app.route("/about")
# the function about to run at /about route
def about():
return "About Project"
# to make flask powerful to handle routes
<span class="highlight-marker">@app.route("/<string:name>")</span>
# the function to run at / route
def welcome(name):
str = "Welcome <b>{}</b> to coding!"
return str.format(name)
</code>
</pre>
</div>
<h5 class="display-6">command</h5>
<p>Set the enviroment variable <em>FLACK_APP</em> to tell flask the file to run the application from is called <b>app.py</b>
<p>Run flask application in terminal: <br> <code>export FLASK_APP=app.py <br>
export FLASK_ENV=development <br>flask run</code></p>
</p>
<p><mark>Success!</mark> Copy <em>http://127.0.0.1:5000/</em> into web browser address bar to execute the <code>index()</code> which displays "Welcome to Coding" message.</p>
<p>Type <em>http://127.0.0.1:5000/about</em> to execute the <code>about()</code> which returns the "About Project" message</p>
<p>Type <em>http://127.0.0.1:5000/Jane</em> to execute the <code>welcome()</code> which returns the "Welcome NAME to coding!" message</p>
<div class="container" id="templating">
<h3 class="display-4 text-center">templating with HTML files</h3>
<p>Create a subdirectory <b>templates</b> in project folder</p>
<p>Right click on <b>templates</b> > Select <b>New File</b> > save and name file <code>index.html</code></p>
<p>In <b>index.html</b> type the below code which intergrates Bootstrap starter template</p>
<div class="my-2 bg-dark rounded-lg">
<pre class="p-3">
<code class="text-white">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta http-equiv="Cache-control" content="no-cache">
<title>Learning Javascript and Python</title>
<!-- Bootstrap CSS -->
<span class="highlight-marker"><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"></span>
<!-- Custom CSS -->
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container">
<!-- Using Jinja2 templating syntax to put value of a variable into the template -->
<h1 class="display-1 text-center">Welcome to <span class="highlight-marker">{{headline}}</span>!</h1>
</div>
<span class="highlight-marker"><!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script></span>
</body>
</html>
</code>
</pre>
</div>
<p>In <b>app.py</b> type the below code</p>
<div class="my-2 bg-dark rounded-lg">
<pre class="p-3">
<code class="text-white">
from flask import Flask, <span class="highlight-marker">render_template</span>
# create an application which is called Flask
app = Flask(__name__)
@app.route("/")
def index():
# headline is dynamically rendered by flask, depending on the pass to variables value "Coding"
headline = "Coding"
return <span class="highlight-marker">render_template("index.html", headline=headline)</span>
</code>
</pre>
</div>
<p><small>(Press CTRL+C to quit)</small> web server</p>
</div>
</div>
<div id="deploy" class="container">
<h3 class="display-4 text-center">deploy app</h3>
<h5 class="display-6">Pipenv</h5>
<p>If you're on MacOS, you can install Pipenv easily with Homebrew: <code>brew install pipenv</code> <br><br><mark>Note:</mark> You might have to update homebrew using <code>brew update</code></p>
<p>Open terminal (Mac) or command prompt (PC) > Type <code>cd /path/to/directory</code> and <em>click enter/return</em></code>
</p>
<p>In terminal (Mac) or command prompt (PC) > Type <br><code>pipenv install</code> and <em>click enter/return</em></p>
<p><mark>Success!</mark> > Type <br><code>pipenv shell</code> and <em>click enter/return</em><br><code>export FLASK_APP=app.py</code><br><code>flask run</code> <br><br><mark>Success!</mark> > Press CTRL+C to quit</p>
<p>Before sharing to the app with the world! Test by > Typing <br><code>flask run --host=0.0.0.0</code> and <em>click enter/return</em> <br><br><mark>Success!</mark><code>http://0.0.0.0:5000/</code> (Press CTRL+C to quit)</p>
<p>Ready for app deployment to hosting env</p>
</div>
<div id="hosting" class="container">
<h3 class="display-4 text-center">deploy to Godaddy <small>(hosting service)</small></h3>
<h5>Using cPanal Terminal</h5>
<p>Open favorite web browser > Enter in the address bar <b>domainname.extension/cpanel</b></p>
<p>Login using username/password > Search for <b>Terminal</b> <small>found in the Advanced panel</small> > Click <em>Terminal</em></p>
<hr>
<h5>Using Desktop Terminal</h5>
<h5>Ported PuTTY for Mac <small>Installation using HomeBrew</small></h5>
<p>Open terminal (Mac) or command prompt (PC) > Type <code>brew update <br>brew cleanup <br>brew install putty</code> <br><br><mark>Error: Permission denied @ apply2files - /usr/local/share/.config/yarn/global/node_modules/ios-deploy/_Frameworks/MobileDevice.framework</mark><br>To resolve issue use: <code>sudo chown -R $(whoami) $(brew --prefix)/* <br>brew cleanup</code></p>
<p><a href="https://towardsdatascience.com/installing-python-3-and-flask-on-godaddy-1635fe6f24bc">Installing Python 3 and Flask on GoDaddy</a></p>
<h5>Ported PuTTY for Mac <small>Installation using MacPorts</small></h5>
<p>Follow step at <a href="https://onvinetech.wordpress.com/2016/01/26/49/" target="_blank" rel="nofollow">How to install Putty on Mac (OS X El Capitan)</a></p>
<p><a href="https://www.macports.org/install.php" target="_blank" rel="nofollow">macports</a><br>Agree to Xcode license in Terminal: <code>sudo xcodebuild -license</code></p>
<p><a href="https://www.xquartz.org/" target="_blank" rel="nofollow">XQuartz</a></p>
<p class="h3 text-uppercase text-monospace"><i class="fas fa-exclamation-triangle mr-2"></i>Restart Computer <small class="text-lowercase">required for full MacPorts and XQuartz installation</small></p>
<p>Open terminal (Mac) or command prompt (PC) > Type <code>sudo port install putty</code> <small>(Type Y when prompt)</small><br>The below message appear after putty installation:</p>
<div class="my-2 bg-dark rounded-lg">
<pre class="p-3">
<code class="text-white">
python38 has the following notes:
To make this the default Python or Python 3 (i.e., the version run by the
'python' or 'python3' commands), run one or both of:
sudo port select --set python python38
sudo port select --set python3 python38
</code>
</pre>
</div>
<h5>access PuTTY for Mac <small>Steps</small></h5>
<p>Type <code>Putty</code> into terminal <br><br><mark>create a shortcut <code>cp /opt/local/bin/putty ~/Desktop/PuTTY</code></mark></p>
<h5 class="display-6">using Putty</h5>
<p><a href="https://docs.cpanel.net/cpanel/security/ssh-access/82/" target="_blank" rel="nofollow">cPanel & WHM Documentation / cPanel / Security /SSH Access</a></p>
<p><mark>Error: Shell access is not enabled on your account! <br>
If you need shell access please contact support. <br>
<b>Resolve:</b> <a href="https://www.godaddy.com/help/enable-ssh-for-my-linux-hosting-account-16102" target="_blank" rel="nofollow">Enable SSH for my Linux Hosting account</a></mark></p>
<ul>
<li>Execute <em>Desktop/PuTTY</em> application/shell</li>
<li>Host: <b>domainname.extention</b> <small>domainname.com</small> / Port: <b>22</b></li>
<li>Enter username / password</li>
<li><p><a href="https://account.godaddy.com/products" target="_blank" rel="nofollow">Locate login info</a><br>Expand <b>Web Hosting</b> > Locate Hosting domainname.extension & Click Manage > Setting panel (cPanel login/Password)</p></li>
</ul>
<h5>installation and configure Python <small>hosting server</small></h5>
<div class="my-2 bg-dark rounded-lg">
<pre class="p-3">
<code class="text-white">
## Download Python 3.7.3 (latest version GoDaddy supports as of writing)
$ wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
## Once wget is done downloading
$ tar xvzf Python-3.7.3.tgz
## Once tar is done decompressing
$ cd Python-3.7.3
## This should take you to the main Python Directory
./configure --prefix=$HOME/.local
## This step sets up your configuration and makes files
$ make
$ make install
## Bash profile configuration file:
$cd $home
$ nano .bash_profile
# Python 3
## Press enter and change the file to equal this EXACTLY
PATH=$HOME/.local/bin:$PATH
export PATH
$ source ~/.bash_profile
$ python3 -V
</code>
</pre>
</div>
<p><mark>Congratulations!</mark> Python3 onto GoDaddy</p>
<p><mark>Reference:</mark><a href="https://www.godaddy.com/garage/how-to-install-and-configure-python-on-a-hosted-server/" target="_blank" rel="nofollow">Install and configure Python</a></p>
<h5>Config Web App on GoDaddy</h5>
<ul>
<li>Open favorite web browser > Enter in the address bar <b>domainname.extension/cpanel</b></li>
<li>Login using username/password > Search for <b>Setup Python App</b> > Click <em>Setup Python App</em></li>
<li>
Create web application with below config:
<dl class="row">
<dt class="col-sm-3">Python version</dt>
<dd class="col-sm-9">3.7.3</dd>
<dt class="col-sm-3">Application root</dt>
<dd class="col-sm-9"><em>AppName</em></dd>
<dt class="col-sm-3">Application URL</dt>
<dd class="col-sm-9"><em>AppName</em></dd>
<dt class="col-sm-3">Application startup file</dt>
<dd class="col-sm-9">start.py</dd>
<dt class="col-sm-3">Application Entry point</dt>
<dd class="col-sm-9">app</dd>
</dl>
</li>
<li>Create and Start App</li>
<li>Next to Application URL > Click <b>open</b> link</li>
<li>A new browser tab <b>https://www.domainname.extension/<em>AppName</em></b> with the message <br><code>It works! <br>Python 3.7.3</code></li>
</ul>
<h5>Installing Flask</h5>
<div class="my-2 bg-dark rounded-lg">
<pre class="p-3">
<code class="text-white">
## Activate the virtual environment
# Make sure you activate the virtual environment with
$ source <em>AppName</em>/bin/activate
$ pip install Flask
$ deactivate
$ <span class="highlight-marker">source /home/USERNAME/virtualenv/<em>AppName</em>/3.7/bin/activate && cd /home/USERNAME/<em>AppName</em></span>
$ ls -la
$ export FLASK_APP=start.py
</code>
</pre>
</div>
<p><code>passenger_wsgi.py</code> This file is used by Passenger, a web application server that uses the WSGI (Web Server Gateway Interface) convention to provide the glue between your python application and our webservers.</p>
<div class="my-2 bg-dark rounded-lg">
<pre class="p-3">
<code class="text-white">
import imp
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
wsgi = imp.load_source('wsgi', 'start.py')
<span class="highlight-marker">application = wsgi.application</span>
</code>
</pre>
</div>
<p>The cPanel created a basic application startup file <code>start.py</code></p>
<div class="my-2 bg-dark rounded-lg">
<pre class="p-3">
<code class="text-white">
from flask import Flask
<span class="highlight-marker">application = Flask(__name__)</span>
<span class="highlight-marker">@application.route("/")</span>
def hello():
return "Welcome to your FLASK application!\n"
if __name__ == "__main__":
<span class="highlight-marker">application.run()</span>
</code>
</pre>
</div>
<p class="h4">Click the <b>Restart</b> button</p>
<p>Next to Application URL > Click <b>open</b> link <br><br><mark>Note: execute hard refresh; Clear browser cache to view</mark></p>
<p>To Exit <b>XQuartz</b> > In terminal (Mac) or command prompt (PC) > Type <code>exit</code> and <em>click enter/return</em></p>
</div>
<div class="container text-center my-5">
<p class="h2"><i class="fas fa-laptop-code mr-3"></i>My first web app</p>
<p>It's nothing fancy but it took a full weekend to get it to work <a href="https://www.redesigningtech.com/markets" target="_blank">here</a></p>
</div>
</div>
<div id="contactus" class="container mb-5">
<h2 class="display-4 text-center">contact us</h2>
<div class="row">
<div class="col-md-6 col-lg-4">
<dl class="row">
<dt class="col-md-4">Location</dt>
<dd class="col-md-8">New York, New York</dd>
</dl>
</div>
<div class="col-md-6 col-lg-5">
<dl class="row">
<dt class="col-md-4">Reach Out</dt>
<dd class="col-md-8"><a href="tel:+13473917189">+1-347-391-7189</a></dd>
</dl>
</div>
<div class="col-md-12 col-lg-3">
<ul class="list-inline icons-social-media text-center">
<li class="list-inline-item"><a href="mailto:info@redesigningtech.com"><i class="fas fa-envelope"></i></a></li>
<li class="list-inline-item"><a href="https://github.com/berryny/cafe-tech" target="_blank"><i class="fab fa-github"></i></a></li>
<li class="list-inline-item"><a href="https://www.linkedin.com/in/jdesire/" target="_blank"><i class="fab fa-linkedin-in"></i></a></li>
<li class="list-inline-item"><a href="https://twitter.com/judidesire" target="_blank"><i class="fab fa-twitter"></i></a></li>
</ul>
</div>
</div>
</div>
</main>
<footer class="footer container-fluid text-center">
<p class="p-3 m-0">© copyright 2020 | design & coding by Judith Desire
</footer>
<script rel="preload" as="script" src="../js/jquery.js"></script>
<script rel="preload" as="script" src="../js/popper.min.js"></script>
<script rel="preload" as="script" src="../js/bootstrap/bootstrap.min.js"></script>
<!-- FareHarbor Lightframe API - do not remove - see: https://fareharbor.com/help/website/resources/lightframe-api/ -->
<script rel="preload" as="script" src="https://fareharbor.com/embeds/api/v1/?autolightframe=yes"></script>
<!-- NOTE: testing -->
<!-- <script src="//cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.7/ScrollMagic.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.7/plugins/debug.addIndicators.min.js"></script> -->
</body>
</html>