Giter Club home page Giter Club logo

mikeckennedy / python-for-entrepreneurs-course-demos Goto Github PK

View Code? Open in Web Editor NEW
281.0 43.0 138.0 10 MB

Contains all the "handout" materials for Talk Python's Python for Entrepreneurs course. This includes notes and the final version of the website code.

Home Page: https://training.talkpython.fm/courses/explore_entrepreneurs/python-for-entrepreneurs-build-and-launch-your-online-business

License: MIT License

Python 69.51% CSS 23.31% JavaScript 0.13% HTML 7.02% Shell 0.03%
python entrepreneurs entrepreneurs-course sqlalchemy orm stripe bootstrap database python3

python-for-entrepreneurs-course-demos's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-for-entrepreneurs-course-demos's Issues

Continuity gap between video demo and source code

This time I paid extremely careful attention to the content of the videos while following along.

In this video:
https://training.talkpython.fm/player/course/python-for-entrepreneurs-build-and-launch-your-online-business/lecture/51012

I was able to follow along and run the app, and watch the logging from sqlalchemy.

But in the next video, there is a huge leap and gap in continuity.
https://training.talkpython.fm/player/course/python-for-entrepreneurs-build-and-launch-your-online-business/lecture/51012

It was impossible to get the app to run if you followed the videos exactly in sequence. There are a bunch of missing files and code that are not mentioned up to this point.

Sure, I could jump ahead to the end and just run the code from the repo for the chapter, but that omits steps that are necessary to reach the destination.

cookiecutter not working on mac

when I try to run the following cookiecutter command:
cookiecutter https://github.com/Pylons/pyramid-cookiecutter-starter

I get the following error:

Traceback (most recent call last):
File "/Users/afowler/Desktop/test_project/.env/bin/cookiecutter", line 11, in
sys.exit(main())
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/cookiecutter/cli.py", line 120, in main
password=os.environ.get('COOKIECUTTER_REPO_PASSWORD')
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/cookiecutter/main.py", line 63, in cookiecutter
password=password
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/cookiecutter/repository.py", line 103, in determine_repo_dir
no_input=no_input,
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/cookiecutter/vcs.py", line 99, in clone
stderr=subprocess.STDOUT,
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 336, in check_output
**kwargs).stdout
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git', 'clone', 'https://github.com/Pylons/pyramid-cookiecutter-starter']' returned non-zero exit status 1.

I'm using Python 3.6.3 and Mac OS High Sierra version 10.13.2. Any idea what the problem could be?

Consider an alternative to Bower

It looks like the Bower team is recommending npm or yarn for new UI projects. It would be helpful to add yarn/npm as an alternative or in place of Bower in the videos/repository.

Build Web Apps with Pyramid: Part 1: PyCharm Demo - App will not run

Hi Michael,

I'm on a windows machine, running PyCharm Pro (free trial), and I created a venv that did not offer 'None' as a Template Language setting, the only options are Django and Jinja2.

template settings

I mention that in case it has to do with the error message I got when I tried to run the app.

C:\Users\imonat\Desktop\Python_Scripts\blueyellow_pycharm_app\development.ini
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 2016.3.2\helpers\pycharm\pycharm_load_entry_point.py", line 12, in
sys.exit(f())
File "C:\Users\imonat\blueyellowpy\lib\site-packages\pyramid\scripts\pserve.py", line 40, in main
return command.run()
File "C:\Users\imonat\blueyellowpy\lib\site-packages\pyramid\scripts\pserve.py", line 210, in run
setup_logging(config_path, global_conf=vars)
File "C:\Users\imonat\blueyellowpy\lib\site-packages\pyramid\scripts\common.py", line 34, in setup_logging
parser.read([path])
File "C:\Users\imonat\AppData\Local\Programs\Python\Python35-32\lib\configparser.py", line 696, in read
self._read(fp, filename)
File "C:\Users\imonat\AppData\Local\Programs\Python\Python35-32\lib\configparser.py", line 1089, in _read
fpname, lineno)
configparser.DuplicateOptionError: While reading from 'C:\Users\imonat\Desktop\Python_Scripts\blueyellow_pycharm_app\development.ini' [line 15]: option 'pyramid.includes' in section 'app:main' already exists

Process finished with exit code 1

Can you interpret the cause of the error? I'm not understanding what it wants. I was able to get the app to run using the cmd line, but love how much faster Pycharm is, just need to get it running! Thank you for your help!

'blue_yellow_app' distribution was not found and is required by the application

Hi, getting this error below. I downloaded the repo and opened it in pycharm. Pycharm prompted me to run the setup which I did, but get this error below:

File "/home/jia/.virtualenvs/final_2_blue_yellow_app/lib/python3.5/site-packages/setuptools-39.1.0-py3.5.egg/pkg_resources/init.py", line 892, in require
File "/home/jia/.virtualenvs/final_2_blue_yellow_app/lib/python3.5/site-packages/setuptools-39.1.0-py3.5.egg/pkg_resources/init.py", line 778, in resolve
pkg_resources.DistributionNotFound: The 'blue_yellow_app' distribution was not found and is required by the application

raise.exc.HTTPFound() in BaseController.redirect() results in pyramid_debugtoolbar error.

This is taken from example "04-applied-web/final_4_blue_yellow_app" and shows up in the console after attempting a valid "Register" of a new user.

This seems to be related to recent bugs reported at:

  • Pylons/pyramid_debugtoolbar#319
  • Pylons/pyramid_debugtoolbar#320
    The former seems similar to the problem here. The latter seems to be the root cause and a merged fix. One of the comments on the former is: "We don't recommend raising HTTPFound unless it truly is an exception..." Oh? It seems like this was fixed in pyramid-debugtoolbar 4.3? I have that version, but the problem persists.

Below is the trace I see on the console (with my home directory slightly doctored):

Serving on http://localhost:6543
Calling register via GET...
Calling register via POST...
Redirecting to account index page...
2017-12-30 17:07:45,926 ERROR [pyramid_debugtoolbar:257][waitress] Squashed Exception at 
http://localhost:6543/account/register
traceback url: http://localhost:6543/_debug_toolbar/34353230303932373834/exception
Traceback (most recent call last):
  File "/Users/rick/web.env/lib/python3.6/site-packages/pyramid/tweens.py", line 39, in excview_tween
    response = handler(request)
  File "/Users/rick/web.env/lib/python3.6/site-packages/pyramid/router.py", line 156, in handle_request
    view_name
  File "/Users/rick/web.env/lib/python3.6/site-packages/pyramid/view.py", line 642, in _call_view
    response = view_callable(context, request)
  File "/Users/rick/web.env/lib/python3.6/site-packages/pyramid/config/views.py", line 181, in __call__
    return view(context, request)
  File "/Users/rick/web.env/lib/python3.6/site-packages/pyramid/viewderivers.py", line 390, in attr_view
    return view(context, request)
  File "/Users/rick/web.env/lib/python3.6/site-packages/pyramid/viewderivers.py", line 368, in predicate_wrapper
    return view(context, request)
 File "/Users/rick/web.env/lib/python3.6/site-packages/pyramid/viewderivers.py", line 439, in rendered_view
    result = view(context, request)
  File "/Users/rick/web.env/lib/python3.6/site-packages/pyramid/viewderivers.py", line 124, in _class_requestonly_view
    response = getattr(inst, attr)()
  File "/Users/rick/Learn/Py4Entr/py4ent-demos/04-applied-web/final_4_blue_yellow_app/blue_yellow_app/controllers/account_controller.py", line 43, in register_post
    self.redirect('/account')
  File "/Users/rick/Learn/Py4Entr/py4ent-demos/04-applied-web/final_4_blue_yellow_app/blue_yellow_app/controllers/base_controller.py", line 23, in redirect
    raise exc.HTTPFound(to_url)
pyramid.httpexceptions.HTTPFound: The resource was found at

No resource was listed by last output line.

'clear' is not recognized as an internal or external command

Hi Michael,

I'm just starting your Python for Entrepreneurs course and am enjoying it so far.

I just finished the Python language refresher game and although my code runs, it contains this message about the word 'clear'. (see below)

I tried copying your code from github into my file and the message still displays, so I don't think it's a bug in my code, but perhaps some system setting that needs changing. I'm on Windows 7 and using PyCharm.

Couldn't find the exact fix on Stackoverflow so I thought I'd ask you how to get rid of it, it's more annoying than anything. Thank you. -Ian

C:\Users\imonat\AppData\Local\Programs\Python\Python35-32\python.exe C:/Users/imonat/Desktop/Python_Scripts/PyForEnt/program.py
'clear' is not recognized as an internal or external command,
operable program or batch file.
Blue  'clear' is not recognized as an internal or external command,
operable program or batch file.
1 moves:
Next [r,g,b,y]: b
'clear' is not recognized as an internal or external command,
operable program or batch file.
Blue  Yellow  'clear' is not recognized as an internal or external command,
operable program or batch file.
2 moves:
Next [r,g,b,y]: b
Next [r,g,b,y]: y
'clear' is not recognized as an internal or external command,
operable program or batch file.
Blue  Yellow  Yellow  'clear' is not recognized as an internal or external command,
operable program or batch file.
3 moves:
Next [r,g,b,y]: r
Sorry, that was wrong
Game over

Process finished with exit code 0

Cannot resolve directory 'static' in PyCharm Professional

I am having a problem with PyCharm using relative imports in my template files. I have found resources that provide solutions for a Django project. I have not been able to find anything specific about Pyramid projects. It would be helpful if I could see affected css tags when highlighting in the template as I see in your videos.

Cache busting: the demo -- can't run index.pt

Hi Michael,

I'm following along in the Cache busting lesson and I'm getting some unexpected behavior from PyCharm when I run index.pt.

In the video, you run index.pt in PyCharm and a link appears in a terminal, and when you click the link, a browser opens, displaying the minimally-styled webpage.

When I try running the file (on Windows with the free version of PyCharm), index.pt pops up as a 'Save As' download in my default browser (Chrome). (see img below)

image

image

I tried opening it after I downloaded it but Windows was confused as to which application to use. I saw your tip in the video to hit Shift + F10, but no action happens when I do that.

Any help is appreciated, thanks!

Better leaky abstraction for handlers

The course uses a custom @suppress decorator. Now I've learned about __autoexpose__ that is a better solution and will likely be moved into the course.

Video 50807 - NameError: name 'static_cache' is not defined

When attempting to run the project in the video, an error is reported.

I was pretty careful to make sure I have all the same files and their content to align with what's in the video, but I must have missed a critical piece.

Traceback (most recent call last):
File "/Users/stevepiercy/projects/entre/env/lib/python3.5/site-packages/pyramid_debugtoolbar/toolbar.py", line 215, in toolbar_tween
response = _handler(request)
File "/Users/stevepiercy/projects/entre/env/lib/python3.5/site-packages/pyramid_debugtoolbar/panels/performance.py", line 57, in resource_timer_handler
result = handler(request)
File "/Users/stevepiercy/projects/entre/env/lib/python3.5/site-packages/pyramid/tweens.py", line 62, in excview_tween
reraise(*attrs['exc_info'])
File "/Users/stevepiercy/projects/entre/env/lib/python3.5/site-packages/pyramid/compat.py", line 148, in reraise
raise value
File "/Users/stevepiercy/projects/entre/env/lib/python3.5/site-packages/pyramid/tweens.py", line 22, in excview_tween
response = handler(request)
File "/Users/stevepiercy/projects/entre/env/lib/python3.5/site-packages/pyramid/router.py", line 155, in handle_request
view_name
File "/Users/stevepiercy/projects/entre/env/lib/python3.5/site-packages/pyramid/view.py", line 612, in _call_view
response = view_callable(context, request)
File "/Users/stevepiercy/projects/entre/env/lib/python3.5/site-packages/pyramid/viewderivers.py", line 438, in rendered_view
result = view(context, request)
File "/Users/stevepiercy/projects/entre/env/lib/python3.5/site-packages/pyramid/viewderivers.py", line 123, in _class_requestonly_view
response = getattr(inst, attr)()
File "/Users/stevepiercy/projects/entre/blue_yellow_app/blue_yellow_app/controllers/home_controller.py", line 11, in index
'build_cache_id': static_cache.build_cache_id
NameError: name 'static_cache' is not defined

redirect from email subscribe raises error on success and fail redirect

I am working through the email module and when I subscribe to my list I see a pyramid debug toolbar message that it is squashing an exception HTTP.Found when I send POST request to /newsletter/add_subscriber from the little subscribe form.

Is this an exception we should be concerned about or is it just part of running the app in develop mode?

It seems redirect feature will always raise an exception.

base_controller.py line 23

static_cache.py was using incorrect path

Hi,

I had to modify the code in the static_cache.py file because the variable __full_path was giving the directory as blue_yellow_app/infrastructure. When it goes to build the cache ID here below, it looks for the relative url given in the templates as /static/**** and joins it, giving a fullname = /blue_yellow_app/infrastructure/static/*** - and the .css files are not there.

fullname = os.path.abspath(os.path.join(
__full_path, relative_file_url.lstrip('/')))

i modified the code to look for the files one more directory up where /static is by calling os.path.dirname on the __full_path variable like so:

__full_path = os.path.dirname(os.path.abspath(file))
__base_path = os.path.dirname(__full_path)

Explanation how to run a CLI project in pycharm community

Hi,
Just thought that you may want to add the instructions how to run a CLI pyramid project in pycharm community addition. (after running the CLI commands)

In windows it was something of this sort

  1. Add local virtual environment to project settings / interpreter Drive:\Full_path_to_folder\virtualenv\blueyellow\Scripts\python.exe
  2. edit configuration for running project:
    2.1. Script: Drive:\Full_path_to_folder\virtualenv\blueyellow\Scripts\pserve-script.py
    2.2. Script parameters Drive:\Full_path_to_folder\blue_yellow_app\development.ini

bower install bootstrap-css version issue

When you use bower install bootstrap-css, it gives you bootstrap-css version 3.3.6. However when I tried downloading and using the startbootstrap template, the navbar collapsing wasn't working; I checked and noticed the download zipfile from bootstrap includes bootstrap-css version 3.3.7. When I dropped in 3.3.7 instead of 3.3.6 into pycharm, the nav bar started working properly. I'm not sure if there's another way to use Bower to get the latest bootstrap-css version, but thought this was an issue worth sharing. I opened an issue on the bower-bootstrap-css github on this, so hopefully they'll just fix it there.

Cloning git repo onto server fails: "failed to get the hostkey for github.com"

When cloning the forked git repo to the deployment server I receive the following error:

fatal: [167.99.175.241]: FAILED! => {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_args": {
            "accept_hostkey": true,
            "bare": false,
            "clone": true,
            "depth": null,
            "dest": "/home/deployer/blueyellow",
            "executable": null,
            "force": false,
            "key_file": "/home/deployer/git_deploy_key/read_only_key",
            "recursive": true,
            "reference": null,
            "refspec": null,
            "remote": "origin",
            "repo": "ssh://[email protected]:jboys/python-for-entrepreneurs-course-demos.git",
            "ssh_opts": null,
            "track_submodules": false,
            "umask": null,
            "update": true,
            "verify_commit": false,
            "version": "HEAD"
        }
    },
    "msg": "failed to get the hostkey for github.com"
}

I have been following the deployment chapter from the course and everything up to this point is working fine.

I have double checked the deployment files and they appear to be correct; and the repo has been setup with the deploy key.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.