Exploring the Python World Part III: Tales of a Python Apprentice
From Theory to Practice
A continuation of my second blog post: Exploring the Python World Part II.
Running examples given in the documentation vs running my code for the project
Let’s get positive! Putting aside the installation discrepancies, the first taste of trying these new Python frameworks was a success. My naive spirit came out during the first month of the ChiPy Mentorship Program, and now my perception of learning a new programming language has evolved since my first 2 blog posts.
Let’s see, getting those 5 lines of code on my text editor to run a simple “Hello World!” — Flask App, that was easy. Creating a virtual environment (venv) and “pip install” a dependency… I did that. Following the basic example to scrape a web page using Scrapy … done. (“Scrapy is a web crawling framework”, recommended by my mentor).
A sense of accomplishment — when my app runs:
(venv) C:\Users\Dani\Documents\GitHub\flask_app>python my_app.py
* Restarting with stat
* Debugger is active!
* Debugger PIN: 314-621-307
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [19/Apr/2018 08:05:37] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [19/Apr/2018 08:05:39] "GET /favicon.ico HTTP/1.1" 200 -
--------------------------------------------------------------------from flask import Flask, render_template # my imports at the top
from flask_bootstrap import Bootstrapapp = Flask(__name__) # app instance
bootstrap = Bootstrap(app) # using Bootstrap@app.route('/')
return render_template('welcome.html') # templating
# OR adding html directly into the app. Not recommended.
# return '<h1>Hello World!</h1>'@app.errorhandler(404) # page not found error
return render_template('404.html')if __name__ == '__main__':
app.run(debug=True) # debug mode
In our weekly meetings my mentor Jordan encourages me with positive energy to keep going, but it is hard not to fall into self-criticism as I try to stay away from the cliche, a newbie suffering from “impostor syndrome”. Overall, I think having discipline to continue when progress does not seem as clear as you would like is key.
What I have been up to recently.
Trying to comprehend the following:
- Learning how to choose a relational database. Object Relational Mappers — SQLAlchemy or what Flask provides as an extension, Flask-SQLAlchemy.
- Then, comparing a simple example of a Flask app to a bigger application structure.
I can say with my (non-programmer) background, learning Python for web development feels much like preparing for a diving excursion to Cocos Island (if you don’t want to follow the link: “located 550 km off the Pacific coast of Costa Rica, is the only island in the tropical eastern Pacific with a tropical rainforest” — Exotic? you bet) with just a canoe, a paddle and snorkeling goggles. I have come across this new world in the vast open ocean. I am diving deeper into Flask and web development from a back-end standpoint and it has become a deep-ocean exploration.
The darkness of the deep ocean, resembles the direction of my project at times, where I am taking little steps or moving sideways to adapt to the new challenges that were unknown prior to attempting to execute them. The rare creatures that live miles down below, those are the more complex examples in the documentation as I keep reading what it entails to put together an application. Tying all these pieces together is the big challenge.
2.5 months flew by and there are many concepts in my head that I have just started learning. As I was writing this post, I found a useful piece of advise on another Medium post.
The unknown waters have shaken up my naive spirit. Perhaps it’s just “impostor syndrome” kicking in. Or simply the learning curve of a beginner. Is it possible that Python for Web Dev at this point looks more like a dragon than a snake — mysterious, deceiving my novice brain? The time will come when I identify how to use its superpowers.
For now, a moment of empowerment is every time I activate my virtual environment by running the command:
The longer version for Windows Command Prompt:
What I learned about learning
In my next mini post, I will get into more details of my take outs of virtual environments, installing Scrapy and installing Splash. But moving on, here is a quick summary, and some specific and general tips: (Disclaimer the tips are based on my personal opinion & experiences)
- If you are starting out, when you create virtual environments to practice but also to use in your main projects, make sure to name them something more explicit than just the standard “venv”. Then you will know which one(s) can be deleted later on. There is a funny story behind this one.
- Keep notes of any multi step installation process, more likely you will have go back to it, as well as any specific issues that can help others with the same problems.
- If you are thinking about applying to the ChiPy Mentorship Program, then try to go over courses and books that cover the basics prior to starting the term. Join the Slack channel if you need recommendations. I think having a solid understanding of the basics can help you get more out of the program. Also, try to make it to a project night if you can, so that you get an idea of how the ChiPy community and the program works.
- Consistency and discipline, two key elements to have when getting into programming. It can be hard to stay on track if you are doing something completely different that your full-time job. In this situation, the only hours to work on your programming skills is early in the morning before work, during a lunch break or late at night.
- My reminder — “DON’T STOP NOW!” — it’s an investment! Meeting and working with the ChiPy community members has been a fun ride!
If you read this far, thank you, that’s nice of you. I will wrap up with a useful section (at least I hope it helps).
Where to find inspiration to keep going:
- Read blogs from others that are going through the same as you. In my case, the blog posts from the other ChiPy mentees, as I find out that I’m not the only one struggling and I can relate to their journey.
- Follow developers / data scientists on social media.
- Listen to Podcasts — one recommended by my mentor is called “Talk Python To Me”.
- Keep doing research, explore different topics until you find one that combines your many interest. That’s what I have been hearing anyways and why I should keep going!
- Join and attend to “techy” meetups in the city, that’s how I found ChiPy!