Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of unused imports! #8

Open
deidyomega opened this issue Jul 3, 2014 · 3 comments
Open

Lots of unused imports! #8

deidyomega opened this issue Jul 3, 2014 · 3 comments

Comments

@deidyomega
Copy link

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".

@shea256
Copy link
Owner

shea256 commented Jul 3, 2014

Ah, thanks, great catch!

Looks like the following aren't needed:

request, Response, redirect, url_for, send_file

@deidyomega
Copy link
Author

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 deidyomega reopened this Jul 3, 2014
@dawranliou
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants