I discovered that you can use hilite.me to format source code so it looks nice on blogger.
Paste the source into hilite.me. It gives you pretty html that you can paste into an html editor
print("Hello World");
This blog helps me keep track of programming tricks I've learned, so I don't forget them later
I discovered that you can use hilite.me to format source code so it looks nice on blogger.
Paste the source into hilite.me. It gives you pretty html that you can paste into an html editor
print("Hello World");
I'm writing a library file for django, and I want it to store settings in the settings.py file, which is django's default configuration location for settings. However, I still want the library to work if django isn't installed. Here's how I did it :
This way, it doesn't crash if the reference doesn't exist
try: from django.conf import settings except ImportError: pass
Research online said python doesn't have a direct way to check if the reference exists, so you can use a try / except block instead
try: settings except NameError: settings = None
If settings exists, use the django settings.py file. Otherwise use a flat file
if settings != None: if not settings.configured: settings.configure() self._key_list = settings.MY_LIB_SETTINGS else: filename = "lib_api_config.txt" f = open(filename,"r") file_contents = f.read() f.close() self._key_list = json.loads(file_contents)
The edit api page has a sample html / javascript code that you can put on your server to display a "Hello World" type application that displays a map.
I had some issues, which I've noted above