I need a fourth post! (API project)

jQuery so far

So this is actually turning out to be quite fun. Python is a wonderful language, but sometimes it can be boring. JavaScript seems so pretty and exciting – there’s far too much going on for me at the moment, but I’m sure I’ll come around.

Anyway – I’m learning how to iterate over arrays at the moment, and I’m about to implement some sort of “top-3” system, hence I needed the fourth post 🙂

Well, after a bit more development and much less time than I had expected to spend on this, I’m finished, and it seems to work perfectly 🙂

I’ve put the finished code below.

var blog_show_count = 3;

function handle_array_element(item, index) {
    if (index <= blog_show_count) {
            "<li><a href='"+item.link+"'>"+item.title.rendered+"</a></li>"
    } else {
        // doing nothing :D

$(document).ready(function() {
    var api = "https://elliotpotts.net/blog/wp-json/wp/v2/posts";

    fetch(api).then(response => response.json()).then(
        data => {

That was quick, and it’s effective. I don’t think I’ll stop learning JavaScript, as it will definitely be a powerful and useful tool to combine with Python.

Have a great day :).

ElliotPotts.net API Project

My website homepage (https://elliotpotts.net/) is created with Bootstrap/HTML and some CSS/JS elements. It is not a CMS, like the blog. It’s incredibly static.

I’m a Python programmer – and I’ve never touched a JavaScript project before, and wouldn’t consider doing so with an eleven foot pole.

However I wanted a sidebar where the arrow points which listed my latest 3/5 blog posts.

The first approach I considered was using Flask and Python to retrieve the latest posts using some sort of web-scraping method, and then I could use Jinja to render the results in the template.

But then I did some research – and found WordPress has a native REST API with full CRUD capability… Which is great. However, I’m still a Python programmer – so I still considered using Flask.

But then again, I thought, if I use Flask I need a Python-supporting server to handle the page, which means I have the whole nightmare of Flask deployment to deal with.

So, I thought this might be a good time for me to start picking up another language, JavaScript. Well, jQuery.

So in the end – I’m now using my blog’s API endpoints to return posts to a jQuery document which will modify an unordered list on the page.

Part of the reason I’m making this post is so that I have 2 posts to test with 🙂

The SkyWaves Project

Skip to conclusion


About 6 months ago I began a project named “SkyWaves”. The goal of the project was to be able to quickly convert audio files into audio which was similar to the “8D” craze.

8D or “8-dimension audio” is a gimmick, and nothing more. It’s just another way of saying “ambisonic audio”. The 8D trickery is thanks to a cognitive process called “binaural processing”. There’s a whole load of funky science behind the process of auditory perception, and I cannot explain it properly without covering the whole field of study. To be honest – I don’t fully understand it, I’m not an audio engineer.

Anyway, I threw myself in at the deep end about 6 months ago and began building X and Y interfaces for this “8D audio” magic.

I originally started by using PyQT5, but quickly realised this wouldn’t do what I wanted it to. When I started the project, I was pretty sure I was the first to begin working on a none-commercial standalone “8D-converter”. This has since changed, but I’m positive I can do a better job.

Anyway, because of this reason – I wanted the software to be useable and clean. Using PyQT5 is great for anything but. I’m not so good at design, so the application wouldn’t look nice. The application would also need to be bundled, meaning an installer would be required, or a 40 MB portable executable.

I then switched to the idea of using Flask to power the application. I spent a while working closely with Bootstrap 4 and Flask and eventually got a rendering website which did the job!

However, deployment crushed it all – and I soon realised I had made a mistake which would stop the program from running on deployment, and because of how unprepared I was, the code was disgusting, and my deployment environment was even worse. I quit.

I quit for about 4 months and then decided to investigate alternate deployment methods. I began looking at client-side GUI frameworks again, including Eel and even considering a Python-ElectronJS bridge.

I soon faced the reality that Flask was my best option, and that I should just knuckle down and approach it properly.

So here I am, logging the process of building SkyWaves yet again. I’m going to plan my approach, use virtual environments (which I really don’t do as much as I should), use consistent conventions and structures for a neat project, and focus on building deployable code.

Issue of Deployment

Up until this point, I haven’t cared too much about deployment. But I’m 17 now, and soon to enter University, and then the development industry, so understanding deployment is a personal goal which I’d like to achieve imminently.

I have committed a cardinal sin of Flask development, and any Flask project (excluding my previous attempt at SkyWaves) I have done has been deployed using the Flask development web-server. I usually initiate a new screen in CentOS, begin the application on port XXXX, and then use NGINX to reverse-proxy to the Flask development server. This is, apparently, awful, and I will justify it to myself no longer.

So, I have began learning about popular WSGI systems, which I know now are required for interfacing any real-world Flask applications with a web-server like NGINX. I suppose it makes sense and all, “web server gateway interface”

My plan is to use uWSGI or Gunicorn on a CentOS7 VPS to interface the Flask deployment with NGINX. This will take a while to learn, but so does anything in the development industry.

Issue of Convention

Last time, I didn’t build the application effectively, I neglected conventions and ended up with a 400-line Python document with a mix of everything… Terrible to navigate and even worse to debug.

This time I plan to utilise OOP to its full potential, and I’d like to build an effective project structure that successfully compartmentalises the project and its requirements.

I’m also going to use modules/APIs instead of building functionality raw. For example – last time I did form parsing and user-tracking manually. This time, if there’s a Flask extension that does it better, I won’t turn down the help for the sake of more lines of code.


Any posts tagged with “skywaves” will be extensions of this post, tracking the progress of the project.

The feeling of defeat from my last SkyWaves development failure hasn’t worn off, and I don’t want to succumb to it. I also don’t have a project I’m proud of to showcase, and I’m hoping this might be it.

In 3/4 months time, I want a deployed, secure, efficient, working, error-handling Flask web-application which accepts user-inputted audio files and returns an ambisonic conversion via a clean and responsive user-interface, all nicely contained within a neat virtual environment on a CentOS7 VPS and maintained by a pristine folder structure on GitHub.

Have a great day!

Hello, world?

So, WordPress is behaving finally.

For a supposedly revolutionary blogging system, it sure does throw a fit… No wonder WordPress.com gets away with extortionate hosting prices 🙂

Anyway – this is a random post, and I’ve kept it to test and demonstrate the tagging/categorisation system.