def write_app_urls(app_name):
    """Writes a basic urls.py for a django-app"""
    urls_imports = ['from django.conf.urls import url\n',
        'from . import views\n']
    app_name_line = "app_name= '%s'\n" % app_name
    url_pattern_lines = ['urlpatterns= [\n',
        "  url(r'^$',views.index,name='index'),\n", '  ]\n']
    out_file = open('urls.py', 'w')
    for line in urls_imports:
        out_file.write(line)
    out_file.write(app_name_line)
    for line in url_pattern_lines:
        out_file.write(line)
    out_file.close()
