The other day, Apple officially slapped me in the face (rejected my iphone app). I was heartbroken (not really). Anyways, tonight I was bored so I adapted my iphone app into a web app!
I used python, Flask, deployed it to Heroku, and then pointed my personal domain’s DNS to the heroku site. At first, I was going to use a postgreSQL database to store all of the possible first and last names, but that got too dramatic. (I forgot how to do it), so I ended up just having one file.
First, I included a makename() function that had 2 lists (firstnames and lastnames). Then, I assign firstname to a random item from the firstnames list, and I did the same for assigning the lastname. Then, the function returned a concatenated fullname.
first_name = random.choice(first_names) last_name = random.choice(last_names) full_name = "%s %s" % (first_name, last_name) return full_name
And here is the 2nd function:
@app.route('/') def got(): dj_name = make_name() return render_template('index.html', dj_name=dj_name)
So that was that! All I had to add into my index.html template was {{ dj_name }}! I also put a .css file into my static folder cause I like to get **stylish** 😀 For a good guide to walk you through creating a flask app that will successfully deploy to heroku, follow these instructions.
Katy,
Besides the instructions from Heroku, are you following any sort of guide on your journey to build this web app?
Just curious.
Scott
Hmm…well I just keep making different apps…I don’t have any ideas right now for one big app, so I just keep making small ones. I guess I’m not following any sort of guide. I just keep saying “I’m gonna make this today!” then mess around and see if it works. If it doesn’t, I look up online tutorials.