Giter Site home page Giter Site logo

mattmakai / fullstackpython.com Goto Github PK

View Code? Open in Web Editor NEW
2.9K 157.0 627.0 127.92 MB

Full Stack Python source with Pelican, Bootstrap and Markdown.

Home Page: https://www.fullstackpython.com/

License: MIT License

HTML 92.48% Makefile 0.44% Python 2.83% CSS 4.24% Shell 0.01%
python full-stack static-site twilio tutorials tutorial documentation pelican markdown html

fullstackpython.com's Introduction

fullstackpython.com's People

Contributors

ajschumacher avatar amol- avatar anotherwally avatar aoberoi avatar axd1967 avatar bogdanp avatar cenkalti avatar christophkohl avatar dbader avatar dhamaniasad avatar dolph avatar eprikazc avatar flexd avatar haiiiiiyun avatar huangsam avatar itsderek23 avatar jamescurtin avatar jllorencetti avatar josephpaulmckenzie avatar jwpe avatar kmarekspartz avatar kwhinnery avatar luzfcb avatar mattmakai avatar mjhea0 avatar monop avatar nullism avatar proofit404 avatar qgreg avatar thejohnsub avatar

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

fullstackpython.com's Issues

Slackbot "working" but not responding to messages

Hey Matt!
Grateful for the tutorial, and have gotten everything "working" up until the end when i try to actually interact with the bot. At that point it doesn't respond to anything. I'm using python 3.5.0 and have copied and pasted your code exactly and followed the steps of the tutorial from start to finish (except for the bot_token and bot_id which i have swapped with my own) to ensure correctness. Even get the "StarterBot connected and running" message in my terminal after running the script. Thanks for your time!

Suggested resources for Peewee ORM

First of all, thanks for your awesome site. This is a fantastic resource for the community, well-written, up-to-date, well-maintained and well-organized. Nice work!

I have just a couple suggestions for resources that people may find useful for learning or using Peewee ORM.

Dear Diary, an Encrypted Command-Line Diary with Python: this post has been really popular. It is very concise yet manages to show off a number of cool peewee features. The folks at Team Treehouse liked it so much they based their Python ORMs/Database class on the post! So I think it'd be a good one to add to the list.

Not sure if you think it's redundant, but the documentation's quickstart and the building a twitter app might be helpful. If you were to only include one, I think the "Twitter" one would be the best.

I hope you'll consider adding these resources to the Peewee section as they get a lot of traffic and seem to be useful to folks.

Local file

Hi,

Is it possible to send a local file (an image) in the MMS instead of an online URL?

Let's say I want to send an image C:\image.png, what can I do.

Thanks,

WSGI servers image incorrect

Great project - thanks for your work on creating such a useful resource.

The left-most box on the image here should be labelled 'WSGI server' instead of 'Web Server'.

AttributeError: 'NoneType' object has no attribute 'recv' - slack-starterbot

Hi,

Thanks a lot for the bot - I've copied the code (using Python 3.6.4) and originally received error as follows:

Traceback (most recent call last):
File "c:\Bot\starterbot\lib\site-packages\slackclient\client.py", line 52, in rtm_connect
self.server.rtm_connect(use_rtm_start=with_team_state, **kwargs)
File "c:\Bot\starterbot\lib\site-packages\slackclient\server.py", line 85, in rtm_connect
raise SlackLoginError(reply=reply)
slackclient.server.SlackLoginError
Connection failed. Exception traceback printed above.

I've managed to work it around by removing argument (with_team_state=False):

But now I receive following error:

File "starterbot3.py", line 66, in
command, channel = parse_bot_commands(slack_client.rtm_read())
File "c:\Bot\starterbot\lib\site-packages\slackclient\client.py", line 135, in rtm_read
json_data = self.server.websocket_safe_read()
File "c:\Bot\starterbot\lib\site-packages\slackclient\server.py", line 194, in websocket_safe_read
data += "{0}\n".format(self.websocket.recv())
AttributeError: 'NoneType' object has no attribute 'recv'

Any idea how to handle?

Native apps with Python!

I hope that one day I find a Github project where I can read something like this

Create rich native apps using Python across iOS, Android & Windows Phone, while maximizing code reuse. Share code across device platforms with shared projects or portable class libraries. With 100% of the native APIs exposed, you have full access to device capabilities. Create apps with native user experiences and native performance with Python!

Why is this possible with C# and C++ but not with Python?!

Need money? How about crowd founding such a project on Kickstarter.com?

Common, Python Gurus! Put your brains together and let this dream of many Python fans comme true! Make Python a first class citizen in cross platform - better yet - native app development!

... there is hope --> BeeWare (homepage | github)

Library vs Application

I am unsure whether the current text gives new comers a clear and simple guide line.

https://www.fullstackpython.com/application-dependencies.html

Library vs Application

I think programming is done in libraries and application only contain configuration.

This means if you do programming, then you are inside a library. Even if the library is only used in one place up to now .... but maybe you are successful and you get new customers ...

That's why I think dependencies in Python are done via install_requires in setup.py.

For me requirements.txt is only the result of a successful continuous integration run, created by "pip freeze". This is a good working set since all tests were ok.

Please hit me with arguments and tell me what's wrong with my point of view.

Back to topic:

I think "Library vs Application" could be improved on this page: https://www.fullstackpython.com/application-dependencies.html

What do you think?

bitbucket correction

Just a small correction in the Source Control section. Bitbucket is still free for private repos up to a certain threshold of users which makes it a nice option for personal stuff or smaller teams.

Python on the client

Hi Matt,

I invite you to take a look at the Transcrypt project, that makes it possible to use Python in the browser, just as fast and compact as JavaScript. It's on www.transcrypt.org and also on https://github.com/JdeH/Transcrypt.

Since it really contributes to being able to use Python full stack, it may be worth mentioning on your site.

Kind regards
Jacques de Hooge

Sources for Django/SQLAlchemy statement

In the Django article, section Django ORM resources, lines 223-227, about the future integration of SQLAlchemy in Django :

Note though that some of the Django core committers believe it is only a matter of
time before the default ORM is replaced with SQLAlchemy. It will be a large
effort to get that working though so it's likely to come in Django 1.9 or
later.

It is the first time I hear about this. But what a delight !
However the only public thing close to it, that I found, was a 6-year old branch in the django repo. So it cannot be what you are talking about because you initially made this statement in June 2014 (03bb450).

Could you add a bit more context to this statement :

  • How did you reach this conclusion ? Who/What are your sources ?
  • Who are these adventurous core committers ?
  • Have they already started a branch for this endeavor ?

Still, thank you for your well-organized educational website !

Obtaining API token for Slack StarterBot

Hi Matt,

Thanks a lot for your very helpful tutorial about creating a first slack bot in python (https://www.fullstackpython.com/blog/build-first-slack-bot-python.html). I have tried to follow the instructions, but the place for obtaining the bot's API token seems to have changed. The section "Integration Settings" also no longer seems to be available on the Slack API site. Maybe it's just me not being able to find it, but you might want to take quick look into it, when you have time.
Thanks a lot.

Cheers,

Martin

Another resource: Dive Into Python

Dive into Python 3 is a very good intermediate textbook; more advanced than Python for You and Me, less "hard" than Think Python.

As you can see from the title, it's for Python 3; but for an enhanced review of the basics, or for someone who knows the basics of another language without being an expert developer, I think it's a great resource.

You may want to include this base Docker image for Flask

I made a public (and open source) Docker image with all the bells and whistles that people can use to build a Python Flask web application.

It has uWSGI for running the application, Nginx to serve HTTP and Supervisord to control them, so people don't have to learn how to install and configure all those to build a Python Flask web app.

If there was a Docker image like this one before, I would have liked to find it in your page, so I share this with you in case you want to include it.

It seems that uWSGI and Nginx is one of the more robust and performant ways to deploy a Python web app (here the benchmarks): http://nichol.as/benchmark-of-python-web-servers.

There are even some template projects people can use to bootstrap their own. And also, they don't have to clone the full project or something, they can just use it as a base image.

Docker Hub: https://hub.docker.com/r/tiangolo/uwsgi-nginx-flask/
GitHub: https://github.com/tiangolo/uwsgi-nginx-flask-docker

And thanks for a great guiding site!

Overview map suggestion

I think the map is super helpful and a part of the website that connects everything and could therefore get more attention. I think a tool like raphael or d3 would be really useful here - even if it takes more time than balsamiq, I think it's well worth it.

I'm glad to help, if you need it.

Vim, Python, Data Science.

Hello I have been reading your article about how to learn and setup vim for python.
I have found some great solution for setup and learning vim for python and framework around it (Django, Flask, Pyramid, etc ), but is it possible to setup it for Data Science.
I suppose coding would not be a problem, but what about visualizing, is there some libraries I can install.
Thank You.

Content Typo 'are' in web-development.html

Typo 'are'

Found sentence with a typo on the fourth full paragraph of the live Web Development page, as shown below:

Web Development
...
How does Python fit into web development?
...
However, most Python developers ARE write their web applications in a combination of Python, which is executed on the server side and JavaScript, which is downloaded to the web browser client and executed there.

Possible Fix

The word are should be deleted or replaced with already or will. At least 2 GitHub files include this typo:

Finally, I did not make a pull request with these two changes because I did not know if more dependencies exist, such as these pages being built from another file.

Link to sub-heading inside page

Hi,

first of all, thank you for fullstackpython.

I want to create a link to a sub-heading inside a page.

I would like to link to "Installing Python dependencies" on this page: https://www.fullstackpython.com/application-dependencies.html

I looked at the html source, and I can't see an anchor or id attribute.

I don't know how you generate this page.

It would be nice to have.

BTW, I liked the "Task queue" topic. I reference it from my personal programming guidelines (https://github.com/guettli/programming-guidelines)

Regards,
Thomas Güttler

syntax error.

when I translate the book, if I find some typo or syntax error, it's hard to pull requests, so I open the issue.

http://www.fullstackpython.com/flask.html

this page, the example code of flask's hello world application has a syntax error, it should be like below:

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello World!'

if __name__ == '__main__':
    app.run()

By the way, I have translate 2 pages(click this)into Chinese, and I have read half of the book, write excellently which provide rich resources and the checklists is very particle, I learned much from the book.

Twilio 'post_twilio_api' is not defined

I'm going through the Full Stack Python Deployment PDF. On page 137, I'm attempting to configure Twilio alerts on successful deployment. I have the following in my main.yml:

- name: alert that deployment is complete
  twilio:
    msg: "Deployment complete!"
    account_sid: "{{ wsgi_env_vars.TWILIO_ACCOUNT_SID }}"
    auth_token: "{{ wsgi_env_vars.TWILIO_AUTH_TOKEN }}"
    from_number: "{{ wsgi_env_vars.TWILIO_NUMBER }}"
    to_number: "{{ alert_number }}"
  delegate_to: localhost
  when: deployment_alert

When I run deploy_prod.sh, I get an error that "post_twilio_api" is not defined.

TASK: [common | alert that deployment is complete] **************************** 
failed: [<myip> -> localhost] => {"failed": true, "parsed": false}
Traceback (most recent call last):
  File "/home/<myuser>/.ansible/tmp/ansible-tmp-1449278658.43-275151344117765/twilio", line 2515, in <module>
    main()
  File "/home/<myuser>/.ansible/tmp/ansible-tmp-1449278658.43-275151344117765/twilio", line 123, in main
    r, info = post_twilio_api(module, account_sid, auth_token, msg,
NameError: global name 'post_twilio_api' is not defined

FATAL: all hosts have already failed -- aborting

Tracing back that symbol, it appears to be a function call in the ansible module:
ansible/modules/extras/notification/twilio.py.

I'm running ansible versino 1.9.4, and Twilio support seems to be available in 1.6. Am I missing a module of some sort?

Thanks,
Kyle

Websocket article describes polling instead of long-polling

Polling is the act of checking for new data every x seconds, and immediately discovering whether it's available or not (server immediately responds even if no data).

Long polling is when the client makes a request and if no new data can be immediately returned, remains idle for as long as possible until the server has something to return or a timeout occurs (generally 60 seconds)

Dead links

Hello,
I was reading the Django books and tutorials chapter on the https://www.fullstackpython.com/django.html page and I found some dead links/

Lightweight Django (http://ww1.lightbird.net/dbe2/) and Django: Wall of Superpowers! (http://djangowos.com/) are completely dead.

The page Lincoln Loop's Django Best Practices (http://lincolnloop.com/django-best-practices/) is not showing the guide anymore but a list of books (and a link to the github of the old page)

And the address of Deploying Django on AWS (https://nickpolet.com/blog/deploying-django-on-aws/) seems to have changed to https://nickpolet.com/blog/deploying-django-on-aws/koAayBejnjdNwYfc6

PythonAnywhere

Can you list PythonAnywhere as PaaS? I've had great success working with them and I'm sure new users would benefit from knowing such a service exists.

Use websockets for list of tokens to support multiple slack teams

I am using the same concept as mentioned in test code for one client and reapplying it if I retrieve a list of tokens from a database to create N websockets to support multiple slack teams. When doing so, the code always fails while trying to parse the slack output. Would really appreciate if you can help me understand what's happening wrong here

def parse_slack_output(bot,slack_rtm_output):
AT_BOT = bot
output_list = slack_rtm_output
if output_list and len(output_list) > 0:
for output in output_list:
if output and 'text' in output and AT_BOT in output['text']:
return output['text'].split(AT_BOT)[1].strip().lower(),
output['channel']
return None, None

if name == "main":
#botid is a list of dictionary that is represented in this format, retrieved from a backend db ( {"bot_token":y['bot_token'],"bot_id":y["bot_id"]} )

clients = [SlackClient(str(t['bot_token'])) for t in botid]
for c in clients:
c.rtm_connect()
while True:
	for d in botid:
	bot = "<@" + str(d["bot_id"]) + ">"
        	command, channel =  parse_slack_output(bot,SlackClient(str(d['bot_token'])).rtm_read())
        	if command and channel:
            	handle_command(command, channel)
        	time.sleep(READ_WEBSOCKET_DELAY)

The error I am getting is:

command, channel =  parse_slack_output(bot,SlackClient(str(d['bot_token']))                                                                             .rtm_read())

File "/usr/local/lib/python2.7/dist-packages/slackclient/_client.py", line 120 , in rtm_read
json_data = self.server.websocket_safe_read()
File "/usr/local/lib/python2.7/dist-packages/slackclient/_server.py", line 138 , in websocket_safe_read
data += "{0}\n".format(self.websocket.recv())
AttributeError: 'NoneType' object has no attribute 'recv'

Slackbot receiving links

Hi Matt,

Thanks for the tutorial! I am just getting started with python and decided doing it with a bot it could be interesting.

One problem I stumbled upon is that the function parse_direct_mention don't match if the message contains valid FQDN - slack transforms them into links and the input is something like this <https://google.com|google.com>

Can you help with direction how to solve it?

Description of "Huey" task queue is inaccurate

On the task queues page, the huey library is not described accurately.

I'm the author of huey, and in the project documentation I give the following description of huey:

a lightweight alternative.

  • written in python
  • only dependency is the Python Redis client

supports:

  • multi-process, multi-thread or greenlet task execution models
  • schedule tasks to execute at a given time, or after a given delay
  • schedule recurring tasks, like a crontab
  • retry tasks that fail automatically
  • task result storage

I'd suggest changing the description of "huey" to read something like:

Huey is a Redis-based task queue that aims to provide a simple, yet flexible framework for executing tasks. Huey supports task scheduling, crontab-like repeating tasks, result storage and automatic retry in the event of failure.

What do you think?

Couple of suggestions for the WebSocket page

Overall the content is very good (as usual). But I have a few small corrections:

  • The WebSocket diagram shows only server-push, but that is half of what you can do (as you correctly indicate in the description above). I think it would be good to add independent arrows that go from client to server, to indicate that both the client and the server can freely initiate an exchange at any time.
  • The following sentence is incorrect with respect to the client-side:

Both a JavaScript library on the web browser and a WebSockets implementation on the server are necessary to establish and maintain the connection between the client and server.

There is native support for the WebSocket protocol in most browsers. In many cases clients use a wrapper library, but that is technically not required, as browsers expose the WebSocket object.

I think that either here in this place, or later in the document you have to describe Socket.IO as pair of client and server libraries that wrap WebSocket. The nice thing about Socket.IO is that if you run it on a browser that doesn't have native WebSocket support, it can emulate the real-time communication using long polling or other methods and the implementation differences are hidden by the library. The important point here is that WebSocket != Socket.IO, which I think is not totally clear now.

  • WebSocket friendly servers for Python

A discussion on how to support WebSocket server-side is missing. You mention gevent a couple of times, but I think it would be helpful to discuss the implications of WebSocket on the server. Something on the lines of: since the connection is long lived, a multi-threaded or multi-process based server cannot scale appropriately, so you need an asynchronous server such as gevent for any practical implementation.

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.