Trey Hunner

I help developers level-up their Python skills

Hire Me For Training

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:

It’s responsive

The font size and margin on 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:


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

curl -L

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.


Write more Pythonic code

I send out 1 Python exercise every week through a Python skill-building service called Python Morsels.

If you'd like to improve your Python skills every week, sign up!

You can find the Privacy Policy here.
reCAPTCHA protected (Google Privacy Policy & TOS)