GithubHelp home page GithubHelp logo

lincolnloop / django-best-practices Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ericholscher/django-reusable-app-docs

542.0 542.0 70.0 208 KB

Documentation regarding Django best practices

Home Page: http://lincolnloop.com/django-best-practices/

License: Other

Python 100.00%

django-best-practices'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  avatar  avatar

django-best-practices's Issues

Apache deployment notes

Request via email:

I appreciate your best practices info, but I wish you had an Apache httpd server section.

Thanks for your efforts.

Nginx deployment notes might lead to security issues?

As noted on Twitter earlier i was wondering if the recommendation for setting up nginx should come with a warning to make sure the root var in the nginx config is pointing to a directory with your static files not the root of your django app.

Your config uses the handy try_files shortcut:

root        /var/www/domain.com/;

# Check if a file exists at /var/www/domain/ for the incoming request.
# If it doesn't proxy to Gunicorn/Django.
try_files $uri @django;

This is fine if domain.com has your static files but if you deploy a standard (instead of your suggestion from another part of the best practices) django app layout on your server it will make any python file, including your settings, available for download.

For instance if this is (part of) your app layout:

/var/www/domain.com/
    |- manage.py
    |- settings.py
    |- static/
        |- style.css

A call to http://domain.com/static/style.css will load fine and make it look like you did a fine job deploying following best practices. While at the same time http://domain.com/settings.py will start a download of your settings.py file.

Obviously this is bad and you should not point the root to your app but i'm betting people will read that tip which they will find when googling and then do exactly this...

E-reader format

Would be nice to have this all available as in .mobi / .epub format.

Using URLs' namespaces

From http://lincolnloop.com/django-best-practices/apps/modules/urls.html

Should have a name attribute so they are reversible; APP_MODEL_VIEW, for example blog_post_detail or blog_post_list.

May I suggest:

Should have a name attribute and a namespace so they are reversible and unique to the application, for example blog:post_detail or blog:post_list.

References:
https://docs.djangoproject.com/en/dev/topics/http/urls/#defining-url-namespaces
https://docs.djangoproject.com/en/dev/topics/http/urls/#topics-http-reversing-url-namespaces

How to setup scheduled scripts (e.g. for maintenance)

Please describe how to schedule scripts for simpler tasks. E.g. using BaseCommand. A lot of people suggest setting up urls to start the script, having an external script that import settings and many other complex things. The craziest thing I've seen (but probably useful for some cases) is to have the regular requests from google-bots invoke scripts... That's why I think it's a good thing to suggest managment commands when they're so easy and integrates nicely with your apps.

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.