Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,36 @@ python urls.py

# In browser go to page
http://127.0.0.1:5000/


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

UPDATED FOR PYTHON 3.9.x

## Get repo
C:\>cd \users\you\source\repos
C:\>cd \users\you\source\repos>git clone https://github.com/NathanSF/flask_with_carousel.git

C:\>cd \users\you\source\repos>cd flask_with_carousel

## Create virtualenv
C:\>cd \users\you\source\repos\flask_with_carousel>python -m venv venv

## Set FLASK_APP variable to start py module and activate
C:\>cd \users\you\source\repos\flask_with_carousel>flask_env.bat

## Install reqs (just use latest modules)
(venv) C:\>cd \users\you\source\repos\flask_with_carousel>pip install -r requirements.txt

## Run it
(venv) C:\>cd \users\you\source\repos\flask_with_carousel>flask run
* Serving Flask app 'urls' (lazy loading)
* Environment: development
* Debug mode: on
* Restarting with stat
* Debugger is active!
* Debugger PIN: 123-456-789
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

## In your browser go to
http://127.0.0.1:5000/
3 changes: 3 additions & 0 deletions flask_env.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set FLASK_APP=urls
set FLASK_ENV=development
call venv\Scripts\activate.bat
2 changes: 1 addition & 1 deletion images.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ def get_images(start_index=0):
ret_val = []
for row in results:
ret_val.append(row[0])
# print results
# print(results)

return ret_val
4 changes: 2 additions & 2 deletions import_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
# Import images into DB
start_ind = 81295755

for x in xrange(1, 10000):
for x in range(1, 10000):
index = start_ind + x
url = 'https://d37lj287rvypnj.cloudfront.net/' + str(index) + '/full'

# Insert a row of data
insert_sql = "INSERT INTO images (url, length, width) VALUES (\'" + url + "\',200, 200)"
print insert_sql
print(insert_sql)
conn.execute(insert_sql)

# print url
Expand Down
24 changes: 11 additions & 13 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
Flask==0.10.1
Flask-Assets==0.11
Flask-Scss==0.5
Jinja2==2.8
MarkupSafe==0.23
Werkzeug==0.11.3
enum34==1.1.2
itsdangerous==0.24
pathlib==1.0.1
pyScss==1.3.4
six==1.10.0
webassets==0.11.1
wsgiref==0.1.2
Flask
flask_assets
Flask-Scss
Jinja2
MarkupSafe
Werkzeug
itsdangerous
pathlib
pyScss
six
webassets
3 changes: 1 addition & 2 deletions urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from flask import Flask, request, jsonify, render_template, request
# from flask.ext.scss import Scss
from flask.ext.assets import Environment, Bundle
from flask_assets import Environment, Bundle

from images import get_images
import logging
Expand All @@ -11,7 +11,6 @@

assets = Environment(app)
assets.url = app.static_url_path
# assets.url = app.static_url_path
scss = Bundle('scss/main.scss', filters='pyscss', output='css/all.css')
assets.register('scss_all', scss)

Expand Down