<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jesse Orshan</title>
    <description>The latest articles on DEV Community by Jesse Orshan (@jesseorshan).</description>
    <link>https://dev.to/jesseorshan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F930905%2Fb6c362ce-57a7-4ac7-aeda-6d8f02a9429d.jpg</url>
      <title>DEV Community: Jesse Orshan</title>
      <link>https://dev.to/jesseorshan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jesseorshan"/>
    <language>en</language>
    <item>
      <title>Easily Deploying a Flask App w/ WayScript (for free)</title>
      <dc:creator>Jesse Orshan</dc:creator>
      <pubDate>Thu, 22 Sep 2022 21:18:52 +0000</pubDate>
      <link>https://dev.to/jesseorshan/easily-deploying-a-flask-app-w-wayscript-for-free-2mg4</link>
      <guid>https://dev.to/jesseorshan/easily-deploying-a-flask-app-w-wayscript-for-free-2mg4</guid>
      <description>&lt;h1&gt;
  
  
  In this tutorial, I am going to walk through the basics of setting up and deploying a flask app from scratch using &lt;a href="https://wayscript.com" rel="noopener noreferrer"&gt;WayScript&lt;/a&gt; (a free deployment platform).
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Step 1 - Create a WayScript project.
&lt;/h2&gt;

&lt;p&gt;WayScript projects are referred to as lairs, these are just flexible cloud based development environments for you to run and test your code. &lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2 - Open up the code editor
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fde1r7bvuoy7i0ss29y6w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fde1r7bvuoy7i0ss29y6w.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the &lt;strong&gt;develop&lt;/strong&gt; tab to open your code editor on WayScript. In the editor, you have the following panels:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Editor&lt;/li&gt;
&lt;li&gt;Terminal&lt;/li&gt;
&lt;li&gt;Triggers&lt;/li&gt;
&lt;li&gt;Processes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I'll cover some of these but for now make sure you have the &lt;code&gt;Editor&lt;/code&gt; and &lt;code&gt;Terminal&lt;/code&gt; views open (like in the image above).&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3 - Install Flask
&lt;/h2&gt;

&lt;p&gt;In the &lt;code&gt;Terminal&lt;/code&gt;, input the following two commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install flask
pip freeze &amp;gt; requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4 - Setup Your Files
&lt;/h2&gt;

&lt;p&gt;Now, we are going to add the first file for building your server. In the &lt;code&gt;Terminal&lt;/code&gt;, type the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch app.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once done, you should see the file &lt;code&gt;app.py&lt;/code&gt; appear in the Code Editor. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzh6zjgs2p4ih521hn8ix.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzh6zjgs2p4ih521hn8ix.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5 - Edit your &lt;code&gt;app.py&lt;/code&gt; File
&lt;/h2&gt;

&lt;p&gt;Here is the initial code for your app.py file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def index():
    return {"Message" : "Hello World"}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 6 - Set Up Your Deployment
&lt;/h2&gt;

&lt;p&gt;In order to deploy your app, you need to configure an &lt;strong&gt;deploy&lt;/strong&gt; Trigger. &lt;/p&gt;

&lt;p&gt;In your &lt;code&gt;Triggers&lt;/code&gt; panel, select a Deploy trigger and fill in the following details: &lt;/p&gt;

&lt;h4&gt;
  
  
  Command To Run: &lt;code&gt;flask run --port 8080 --host 0.0.0.0&lt;/code&gt;
&lt;/h4&gt;

&lt;h4&gt;
  
  
  Port: &lt;code&gt;8080&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffz3ooa3x5nkazzavo7ql.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffz3ooa3x5nkazzavo7ql.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7 - Deploy your app!
&lt;/h2&gt;

&lt;p&gt;Once the &lt;code&gt;Trigger&lt;/code&gt; is set up, go the &lt;code&gt;Deploy&lt;/code&gt; tab and press deploy! Now you app is good to go. You can view the app by referencing the URLs in your &lt;code&gt;Endpoints&lt;/code&gt; tab. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F23qn3528jg4km74h08rp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F23qn3528jg4km74h08rp.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Under endpoints, hit the prod url to see your endpoint working!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F62o4hupyejudc4jf351c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F62o4hupyejudc4jf351c.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note - in order to run your server in the dev mode, you must press the play button on the trigger you set up&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Other Notes - Built in logs, processes, and alerts
&lt;/h2&gt;

&lt;p&gt;There are other tabs for viewing logs, your server running, and you can set up automatic alerting if your app has any errors. &lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>python</category>
      <category>webdev</category>
      <category>wayscript</category>
      <category>flask</category>
    </item>
  </channel>
</rss>
