<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Vincent Frimpong</title>
    <link>https://blog.aduuna.dev/</link>
    <description>Recent content on Vincent Frimpong</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Thu, 04 Oct 2018 17:18:20 +0000</lastBuildDate>
    <atom:link href="https://blog.aduuna.dev/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Let&#39;s take it online — Deploying your flask Application to PythonAnywhere</title>
      <link>https://blog.aduuna.dev/lets-take-it-online-deploying-your-flask-application-to-pythonanywhere/</link>
      <pubDate>Thu, 04 Oct 2018 17:18:20 +0000</pubDate>
      <guid>https://blog.aduuna.dev/lets-take-it-online-deploying-your-flask-application-to-pythonanywhere/</guid>
      <description>In this tutorial, we will take a simple flask app from our local machine to a server online. I assume it is your first time doing this and I try to explain...</description>
      <content:encoded><![CDATA[<p>In this tutorial, we will take <a href="https://github.com/puclubug/simple_flask_app">a simple flask</a> app from our local machine to a server online. I assume it is your first time doing this and I try to explain everything to the most basic level. Sorry to the Ninjas</p>
<h3 id="boring-talk">Boring Talk</h3>
<p>You can scroll to the tutorial Section if it gets boring here.</p>
<p><strong>So what the hell is a server?</strong></p>
<p>Let’s make it practical since we&rsquo;ve all used the internet before. When you visit a website to look for information, basically, you are a client on the internet and someone needs to serve you with that information. It is like this:</p>
<ul>
<li>Internet —Restaurants</li>
<li>You the client— Customer</li>
<li>Server — Waiter/Server</li>
<li>request for webPage — Order for food</li>
</ul>
<p>So when we build web apps with Flask, Django, or Pyramid, we are designing what and how to serve our customers so that a computer can serve our clients for us.</p>
<p><strong>Okay, so How Do I Serve?</strong></p>
<p>From what is said above we can tell that a server is just another computer. A computer that does one thing — Serve. Any computer could be a Server. I once used my raspberry pi as a staging server. When you are developing with Django or Flask, you have a development server running on your local machine.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">$ python -m SimpleHTTPServer 8000
</span></span></code></pre></div><p>This command starts a server at port 8000 in the directory it was run from.</p>
<p>But we need a constant power supply, A stable internet connection with a reasonable speed, and sometimes an ample storage space to keep our Restaurant open at all times. That is why we need the services of Server Companies to help us stay online.</p>
<h3 id="tutorial">Tutorial</h3>
<p>We have several options available to us because its 2018 and cloud computing is the hot cake for conglomerates. We will use PaaS/IaaS(Platform as a Service/Infrastructure as a Service) for our hosting because we get to skip operating system configurations, server setup, and focus on deploying fast. Plus it’s cheaper and mostly free. We have Google App Engine, Amazon Web Services, Heroku, and pythonanywhere as our favorite options today. <a href="https://blog.appdynamics.com/product/battle-of-the-paas-python-apps-in-the-cloud/">click here</a> if you want to read more about PaaS/IaaS.</p>
<h3 id="part-1-deploying-to-pythonanywhere">Part 1: Deploying to PythonAnywhere.</h3>
<p>For simplicity, let us all clone this simple app. and see it run locally. Use this only if you don’t have a working flask app but you want to follow the tutorial</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">$ git clone https://github.com/puclubug/simple_flask_app.git
</span></span><span class="line"><span class="cl">$ cd simple_flask_app
</span></span><span class="line"><span class="cl">$ git remote rm origin
</span></span><span class="line"><span class="cl">$ python main.py
</span></span></code></pre></div><p>You can visit <a href="http://localhost:8000/">http://localhost:8000/</a> in your browser to see it run and use CTRL+C to quit the server when done. If you don&rsquo;t have git installed, take a minute to get it <a href="http://git-scm.com">here</a>.</p>
<p>But If you have built your flask app locally on your machine, then in your app’s directory run this in your bash over there</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">echo &#34;# simple_flask_app&#34; &gt;&gt; README.md
</span></span><span class="line"><span class="cl">git init
</span></span><span class="line"><span class="cl">git add README.md
</span></span><span class="line"><span class="cl">git commit -m &#34;first commit&#34;
</span></span></code></pre></div><p><strong>Steps</strong></p>
<ol>
<li>Create accounts on <a href="http://github.com/join">GitHub</a> and <a href="https://www.pythonanywhere.com/ahl/">PythonAnywhere</a> if you haven&rsquo;t done that already and confirm your accounts in your email.</li>
<li>Go to your GitHub account and Add a new repository on GitHub — name it “simple_flask_app”. Leave everything as it is, only enter the name and click on create repository</li>
<li>In your flask app directory, open command prompt and run this but replace my github username — aduuna with yours</li>
</ol>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">git remote add origin https://github.com/aduuna/simple_flask_app.git
</span></span><span class="line"><span class="cl">git push -u origin master
</span></span></code></pre></div><ol start="4">
<li>Let’s create a requirements.txt file, it contains a list of all the installed libraries needed for new python environments to run our code.</li>
</ol>
<p>New File: requirements.txt</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">Click==7.0
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">Flask==1.0.2
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">itsdangerous==0.24
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">Jinja2==2.10
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">MarkupSafe==1.0
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">Werkzeug==0.14.1
</span></span></code></pre></div><p>Those running this in a contained virtual environment can run</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">$ pip freeze &gt; requirements.txt
</span></span></code></pre></div><p>to get it automatically created.</p>
<ol start="5">
<li>Now let’s commit our changes</li>
</ol>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">$ git add .
</span></span><span class="line"><span class="cl">$ git commit -m &#34;Added requirements.txt&#34;
</span></span><span class="line"><span class="cl">$ git push origin master
</span></span></code></pre></div><ol start="6">
<li>Head over to your dashboard on pythonanywhere and click on the blue “$ bash” button to start a bash console on the remote computer pythonanywhere just gave you when you created an account. Treat it just like you treat your bash on your local machine. let us clone our source code onto our new machine:</li>
</ol>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">$ git clone https://github.com/aduuna/simple_flask_app
</span></span></code></pre></div><p>Once again Don’t forget to change my username(aduuna) to yours.</p>
<ol start="7">
<li>click the web tab to add a new web app</li>
</ol>
<p><img alt="In the web Tab, add a new web\u00a0app" loading="lazy" src="https://blog.aduuna.dev/lets-take-it-online-deploying-your-flask-application-to-pythonanywhere/image-01.png"></p>
<p><em>In the web Tab, add a new web app</em></p>
<ul>
<li>Click Next</li>
<li>click Flask then Python3.6</li>
<li>change the path name to “/home/kingkunta/simple_flask_app/main.py”</li>
<li>click Next to complete</li>
</ul>
<ol start="7">
<li>Setup on pythonanywhere is as easy as:</li>
</ol>
<p>on your online console run</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">$ cd simple_flask_app
</span></span><span class="line"><span class="cl">$ mkvirtualenv --python=/usr/bin/python3.6 my-virtualenv
</span></span><span class="line"><span class="cl">$ workon my-virtualenv
</span></span><span class="line"><span class="cl">$ pip install --user -r requirements.txt
</span></span><span class="line"><span class="cl">$ git checkout main.py
</span></span></code></pre></div><ol start="8">
<li>We are done. Reload Website in the web Tab. And view your website online at <a href="https://kingkunta.pythonanywhere.com">https://kingkunta.pythonanywhere.com</a>.</li>
</ol>
<blockquote>
<p>Note: yours will be at <a href="https://your_username.pythonanywhere.com">https://your_username.pythonanywhere.com</a></p>
</blockquote>
<blockquote>
<p>All variables used here like “simple_flask_app”, “my-virtualenv” can of course be replaced by anything of your choice, just keep it simple.</p>
</blockquote>
<h2 id="summary">Summary</h2>
<p>All that we did was to upload our code from our desktop to github and then we download the same code to our computer at pythonanywhere and boom, we had our app online.</p>
<p>I will be back with <strong>Part 2</strong> where we use Heroku to host our webapp, I hope you enjoyed it. If you have any questions, corrections or additions you can send me a quick <a href="mailto:tossia13@gmail.com">email here</a> or leave a <a href="https://wa.me/233264236474">whatsapp message</a></p>
]]></content:encoded>
    </item>
    <item>
      <title>Programming is a journey, Start Today.</title>
      <link>https://blog.aduuna.dev/programming-is-a-journey-start-today/</link>
      <pubDate>Wed, 26 Sep 2018 22:01:05 +0000</pubDate>
      <guid>https://blog.aduuna.dev/programming-is-a-journey-start-today/</guid>
      <description>I have been asked several times by new members of PyClub, “How do I start?”</description>
      <content:encoded><![CDATA[<p>I have been asked several times by new members of PyClub, “How do I start?”</p>
<p>I think maybe sharing my experience would help.</p>
<p>When I was starting out I had nothing but an interest to code. The idea of being able to tell a computer what to do felt like a superpower and I just wanted to have that power.</p>
<p>I was excited about being able to create apps, write automating scripts, build websites, hack websites or mobile devices, or do complex calculations that my 991esPlus calculator can’t do. I just wanted to have that geek ability and it was my drive.</p>
<p>I went online and did a search for “best free python3 introductory books” - and I found a pdf book, &ldquo;Coder’s Apprentice&rdquo; by Peter Spronck</p>
<p>Over the next 6 months, from September 2016 to Feb 2017, I read the book from cover to cover. I could have finished way earlier but I was in my first year at University, I had to study my math courses first.</p>
<p>By the time the 2nd sem started, I already knew enough python to skip the entire CSCD102 course because it was an “Introduction to programming with python” course. Please don’t do this because I didn’t, go there and show the world what you know rather you will learn more by sharing and crashing your code occasionally.</p>
<p>So I had a very firm introduction to python, and I was solving basically every problem with python. In counting problems, when I needed to confirm combinations and permutations with actual simulation I wrote a python script. When I was feeling lazy dealing with logic gates and truth tables, I just wrote code to do it for me. In everyday life, I could spend 10min to write a script that will search through multiple books for a string because coding was just fun.</p>
<p>Now what? That was the question on my mind at that time, my options were enormous, thanks to the articles I read online. I realized I could create games, build Android apps, webapps, do data visualization (graphs and charts) all with this python I knew. Yes, there are more uses, but the aforementioned are the ones I remember trying my hands on. I built a game with pygame, did loads of data visualization(matplotlib and seaborn). Before I tried my hands on Web Development, I tried Kivy Android app development, which was very fun although I never deployed my Android app. All these were from my second book in Python — “Python Crash Course” by Eric Matthes. Except for Kivy - which I found by accident.</p>
<p>At the moment, my reference manuals are:</p>
<ul>
<li>“Two scoops of Django” by Daniel Greenfeld,</li>
<li>“Automate the boring stuff” by Al Sweigart,</li>
<li>And the official python reference and Django reference manuals.</li>
</ul>
<p>I’ve been using Django for close to a year now and I feel comfortable here. Although I’m also interested in Machine Learning and General Scientific programming like Numerical Analysis and Data Analysis, I consider myself a novice in that field, and an intermediate in Web Technologies. I have built a couple of webapps using Django and Flask. Most of them, built for fun, and a few of them for clients as a freelancer.</p>
<p>Currently, I have a coaching role with Global Code(A UK organization) and a volunteer coach at Djangogirls. I’m in my third year in the University and the lead of PyClub UG. So it hasn’t been a bad journey if you asked me.</p>
<p>The bottom line is that you should get something to drive you, share as you learn, stay focused on something you want to do but don’t be afraid to try out interesting technologies when you pick up little projects along the way.</p>
<p>This may not be your exact journey in learning programming with python. Others may like to watch videos rather than read books. Or perhaps take an online course which combines both text and video materials. In that case, <a href="http://cousera.org/learn/python">this one on coursera</a> would be a great start but there are similar or perhaps better ones out there on <a href="http://udemy.com">udemy</a>, <a href="http://pythonanywhere.com">pythonanywhere</a>, and <a href="http://datacamp.com">datacamp</a>.</p>
<p>Here is a link to download all the books mentioned in this article: <a href="https://bit.ly/start-coding-python">https://bit.ly/start-coding-python</a></p>
<blockquote>
<p>Remember, The only way to learn how to code is to code — Anonymous</p>
</blockquote>
<p><img alt="Join Us and Network with beginners and pro’s who use\u00a0python" loading="lazy" src="https://blog.aduuna.dev/programming-is-a-journey-start-today/image-01.jpeg"></p>
<p><em>Join Us and Network with beginners and pro’s who use python</em></p>
]]></content:encoded>
    </item>
    <item>
      <title>A DECISION FOR LIFE, MAKE IT RIGHT</title>
      <link>https://blog.aduuna.dev/a-decision-for-life-make-it-right/</link>
      <pubDate>Fri, 17 Aug 2018 00:26:57 +0000</pubDate>
      <guid>https://blog.aduuna.dev/a-decision-for-life-make-it-right/</guid>
      <description>So it is another semester and we are back to the exact same position we found ourselves in the previous semester. We face this headache at the beginning of...</description>
      <content:encoded><![CDATA[<h3 id="what-courses-do-i-offer-this-semester">What Courses Do I offer this semester?</h3>
<p>So it is another semester and we are back to the exact same position we found ourselves in the previous semester. We face this headache at the beginning of every semester in our academic life where we have to select the courses we want to study. I wrote this piece to share my experience, on how I make decisions concerning my academics. I believe this would be of help to others who find themselves in the same situation.</p>
<p>If you are pursuing an Undergraduate degree at the University of Ghana and you specifically find yourself in the Physical and Mathematical Sciences, then you definitely have this headache as well. Your headache may not be as severe as others because maybe you made your career decisions long before you gained admission or you have had good career guidance but the underlying decision making headache involved in selecting courses every semester can’t be overlooked. Be it Mathematics, Statistics, Physics, Computer Science, IT or Actuarial Science, there’s a sea of courses you can offer in a semester and sometimes due to preferences and popular opinion, it can be very difficult to choose from. These are a few “goto” guidelines to help you make the right decision.</p>
<h3 id="1-know-yourself">1. Know Yourself.</h3>
<p>This is on top of my list because, everything comes down to you in the long run. The final decision is yours to make and the consequences lives with you alone.</p>
<p>Ask yourself these questions:</p>
<ul>
<li>What do I want to become in life?</li>
<li>What do I need in order to get there, that I don’t have?</li>
<li>Am I passionate about this?(i.e Can I do this and not get tired of it?)</li>
</ul>
<p>This will probably reduce your options to the bare minimum. Honest answers to these questions will let you discover that, some options, weren’t even options in the first place. So please read the questions again and write down your answers if you can.</p>
<h3 id="2-research">2. Research.</h3>
<p>Well, you are here so that’s a good start. Read and know what your field is about. Read answers to career questions and career articles related to your field on <a href="https://www.quora.com/">quora</a> or any online forum of your choice. When you don’t find answers that you seek, please ask, there are professors and experts willing to help you because they have been there and they know what it feels like.</p>
<h3 id="3-see-a-professional">3. See a Professional.</h3>
<p>Talk to Career Guidance professional, they know better. University of Ghana makes it possible for students to have access to quality career coaches in the University’s Counselling Centre. It’s about time you paid them a visit if you haven’t done that already.</p>
<p>Also there are course advisors for various levels at every department, provisioned by the Head of department. Please find them and talk to them, they will be more than willing to help. John Boye Quaye (Math Lecturer) and Dr Richard Minkah (Stats Lecturer) have been my personal favorites, I love how they take time to tell you about their personal journey in their careers. Dr Louis Asiedu(Stats Lecturer) and Mr. Micheal A. Soli (Computer science Lecturer) also deserve to be mentioned for the awesome work that they do.</p>
<blockquote>
<p>Pro tips:</p>
</blockquote>
<blockquote>
<p>We are all different individuals and have passion for different things, don’t fall into others passion.</p>
</blockquote>
<blockquote>
<p>Your strength is in your <strong>passion</strong>, when the courses get tough that’s what will take you through.</p>
</blockquote>
<blockquote>
<p>Mathematics, Statistics and Physics are equally <strong>lucrative</strong> fields and highly sought after skills in the job market, just as Computer science and IT, both locally and internationally, don’t let people kill your passion with their ignorance.</p>
</blockquote>
<blockquote>
<p>The fact that you made a ‘D’ doesn’t mean you are bad in that area of study, it will surprise you to learn that some lecturers made <strong>E’s</strong> and <strong>F’s</strong> in the courses they now teach.</p>
</blockquote>
<blockquote>
<p>Don’t let course names or titles scare you, read the course <strong>descriptions</strong> in the course handbook, and do further reading about it online or in the textbooks recommended in the course outline(if you can get it).</p>
</blockquote>
<p>The aforementioned guides tend to focus on career choices at large. I believe once you know where you are heading, your decisions are always “pre-figured” and the the problem boils down to “so which path do I take now?”</p>
<p>The Answer is — Repeat the entire process: Know Yourself, Research and see a Professional.</p>
<p>I Hope you make the best choice now. Good luck.</p>
<p><img loading="lazy" src="https://blog.aduuna.dev/a-decision-for-life-make-it-right/image-01.jpeg"></p>
]]></content:encoded>
    </item>
  </channel>
</rss>
