angular-flask icon indicating copy to clipboard operation
angular-flask copied to clipboard

Lots of unused imports!

Open deidyomega opened this issue 10 years ago • 3 comments

angular-flask / angular_flask / controllers.py

from flask import Flask, request, Response from flask import render_template, url_for, redirect, send_from_directory from flask import send_file, make_response, abort from angular_flask import app

You only using about 1/2 of them. For example "Flask" isn't needed since its imported from "from angular_flask import app".

deidyomega avatar Jul 03 '14 18:07 deidyomega

Ah, thanks, great catch!

Looks like the following aren't needed:

request, Response, redirect, url_for, send_file

shea256 avatar Jul 03 '14 18:07 shea256

Also, on your template:

angular-flask / angular_flask / templates / index.html

<link rel="stylesheet" href="/static/css/bootstrap.css"> <link rel="stylesheet" href="/static/css/main.css">

You should consider doing: <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.css') }}"> <link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/main.css') }}"

Based on the docs: http://flask.pocoo.org/docs/tutorial/templates/#layout-html

Since javascript (angular) isn't executed until the client, and since you have beautifully sepearted your code. You shouldn't worry to much about {{}}. However if later the app gets complex, you can use https://docs.angularjs.org/api/ng/provider/$interpolateProvider

But honestly, your code is great, and I love using it. Amazing work!

deidyomega avatar Jul 03 '14 18:07 deidyomega

Greetings! I'm a new contributor on Github and want to practice working in the open source community! Please let me know if I did anything stupid. Any comments are welcome!

I've taken out the unused imports and updated formats to follow the PEP8 standard. Also, for my own machine the localhost is pointed to address 127.0.0.1 and thus I made the change in angular-lask/runserver.py.

dawranliou avatar Sep 07 '15 22:09 dawranliou