Trey Hunner

programming, teaching, open source

Random Name Generator Website

| Comments

In my last post I discussed the names Python library that generates random names. I’ve now used this Python library to make a basic Flask website that generates random names. You can visit it at: http://www.pseudorandom.name

It’s responsive

The font size and margin on pseudorandom.name change based on the web browser width and height. I determined the font sizes I wanted to use for each screen width by using the longest first and last name in the name files I’m using (11 and 13 characters respectively). The website looks reasonable on various desktop resolutions and on phone screens.

It’s an HTTP API

If curl is used to access the site, plain text is returned instead of an HTML webpage. For example:

curl www.pseudorandom.name

The site is hosted on Heroku which doesn’t support bare domains. Currently http://pseudorandom.name redirects to http://www.pseudorandom.name so using the bare domain requires telling curl to follow redirects with -L:

curl -L pseudorandom.name

More to come?

It might be nice to allow generating multiple names at once, generating gender-specific names, and maybe providing other content types (JSON). The HTML version could also use a cleaner, more feature-full design.

Also it would probably be more efficient to use a SQL database for querying random names so I may eventually abandon the names library and use a database for querying.

The website’s source code is hosted on Github and provided under an MIT license. Feel free to fork it or submit an issue.

Learn more through weekly Python chats 🎁

Like my teaching style? Want to learn more? Sign up for attend my Weekly Python Chat events so I can answer your questions about Python, programming, and life in general.

Comments