This has really been covered ad nauseam. I recommend Digital Ocean. $5 per month for a simple "droplet".
There are some really great guides that will help you get up and running over there as well.
Quentin Tarantino has planned to release Django 2.0 in December 2017. It will be the first film with Python 3 support only and will be supported until April 2019.
Source: https://www.djangoproject.com/weblog/2015/jun/25/roadmap/
I've mentioned it many times in comments but thought it was time for a top-level post:
Think of it as Pjax on steroids. You can get SPA-style performance and behaviour with only a few lines of code. Your rendering and template logic stays in Python/Django.
It won't suit all applications but a huge chunk of the things where people end up reaching for Ember/Angular/React/Vue etc can be handled elegantly and with less code.
Plus you get to write more Python and less Javascript :-)
Django isn't great for building apps that use WebSockets. Personally I like to keep my async code as separate as possible from my regular web framework code though so I don't see this as a huge disadvantage - I've used http://pusher.com/ to add WebSocket features to a Django app successfully in the past.
Two main things:
Django as a system is more loosely coupled. This means that all of the subsystems that make it up are less reliant upon one another and can more easily be swapped out or modified when they aren't up to scratch. I don't know if it's true any more, but in the early days, if you wanted to do any half way complicated queries on the database, RoR's ORM was a huge impediment, whereas while django's couldn't handle every complicated SQL query (and still can't), it was easy enough to drop in SQL in the places where it couldn't with a minimum of fuss.
Django relies less upon 'magic', especially after the 2009-2010 de-magification. See here for some idea of what that means: https://stackoverflow.com/questions/441717/whats-wrong-with-magic
Apart from those I would say the two frameworks are more or less equivalent. They both seem to have a similarly sized ecosystem. e.g. when you want a plugin that does, say, facebook integration or an admin panel they will both have one.
I lost a lot of respect for the Ruby/Rails community also, after the YAML security hole debacle. THIS shit was absolutely goddamn unforgivable:
http://www.kalzumeus.com/2013/01/31/what-the-rails-security-issue-means-for-your-startup/
That's not a normal security hole either. That's a "we forgot that the specification of YAML defines a parser that allows you to run untrusted code by default".
1.4 is LTS (see the bottom of: https://www.djangoproject.com/download/).
Quoting the Release Process (see: https://docs.djangoproject.com/en/1.8/internals/release-process/#long-term-support-lts-releases) > Additionally, the Django team will occasionally designate certain releases to be “Long-term support” (LTS) releases.
(emphasis mine)
As a backend guy, Twitter Bootstrap is the best thing for something fast, simple and pretty clean. You only have to deal with the classes and the markup and that's it. Also you have some javascript plugins, if you want some blink.
Regarding the javascript thing, I mostly use jQuery. I didn't know much of javascript, but it made me do things in a fast way. It has a little learning curve but once you're at it, you can do some cool things.
Here's an old ServerFault post from a Gunicorn developer that toots the Gunicorn horn a bit. I've never actually used uwsgi - the first Django app I deployed was on a gunicorn/nginx setup and I never looked back.
The best way is to follow the 12 factor app -- use environment variables.
We use Deis to host our Django apps, and moving between dev, staging and production is a breeze. The config file never changes, and it doesn't contain any passwords or sensitive keys, so we don't worry about it being checked into git.
I would recommend Django 3 By Example. This book will help you with the practicing part of learning Django from the basics to more advanced topics without ignoring the theory behind it.
I think they're called materialized views in Django. I got the idea from The Temple of Django Database Performance by /u/abrookins
I've found this article that might give you a brief overview of what it is: https://www.fusionbox.com/blog/detail/using-materialized-views-to-implement-efficient-reports-in-django/643/
Other responses have got you covered in terms of options; it sounds like you're hesitant to learn the sysadmin stuff but, to me, it seems like that's your next step in terms of web app learning. Don't be afraid of it, it can be very fun and satisfying and is definitely an essential skill.
Even if you don't go with DigitalOcean, I'd like to point out that DO articles/tutorials are the gold standard in terms of balancing comprehensiveness and ease of use. Here are a couple to get you started:
https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-16-04
https://www.chartjs.org is free and relatively nice out of the box but the clean and modern piece isn't that great.
https://d3js.org is also free but not as nice out of the box. If you can get a hang of it you can make awesome stuff. A lot of the best data visualizations you see on NYT and other popular media are d3. You can add endless interactions, etc. you just need to figure out how to do it which is the tricky part.
Simply start by writing tests for each HTTP endpoint and check the content of the response.
Maybe check out Michael Feathers' <em>Working Effectively with Legacy Code</em> too.
Check out Plotly https://plot.ly/python/. We've been using them for our JS and python apps, they're great. Active, open source development with enterprise support if you need it.
​
Edit: Sorry, I just saw you tried Plotly/Dash. I also used Dash and don't really like it as it is an embedded React app, basically. But plotly itself is just a plotting library, independent of Dash, so it should do everything you need it to. There just aren't really any better free alternatives, tbh.
if you're talking about billing clients for your own freelancing work... don't build that yourself. I use Harvest and I'm happy with it. At $15 a month it's cheaper than if I was paying myself to create my own system and it's far more robust. It's not like your billing system will be a portfolio piece that will get you more work.
now... if you're talking about integrating billing into an existing project, then just make a few forms and hook up the cc transactions with stripe or samurai or something similar.
We autobuild a docker container that is pulled from our repo with all dependencies baked in. Here is the original article I started with last year.
https://semaphoreci.com/community/tutorials/dockerizing-a-python-django-web-application
I found this article that walks you trough the whole process of making it, hopefully you'll find it helpful.https://www.section.io/engineering-education/how-to-build-a-music-player-using-django/ and a good starting point
Check the roadmap here: https://www.djangoproject.com/download/
2.2 will be supported for longer than 3.0 but I highly doubt there will be any hard breaking change between 3.0/3.1/3.2 that would stop you from upgrading by simply installing the newer version.
I've implemented features similar to this one using a JSONField in Postgresql.
This way you can have your users define something like a key:value schema and store that in a normal database table.
I really like PyCharm, and with it's PEP8 linter (not perfect) and some support for debugging, it can help you write better code after you've gotten some experience.
But you need to get that experience. A lot of the tooling built around Django feels like magic if you don't know Django. It's hard to debug what went wrong when your management command is run in, for example, the wrong virtual environment if you don't understand that Django is just calling manage.py
.
I'd recommend using the free PyCharm Community Edition to set up your first Django project following the official tutorial. (This edition doesn't have any built-in support for Django.) Then you can see if you like the editor (and Django) enough to shell out for the Pro edition.
Finally, not to be snarky, but this tutorial is the first thing that comes up when you google "Django PyCharm".
Pycharm, as suggested before here, is great.
But surprisingly, visual code is really good as well. Loads of fine plugins available. Really good to try! https://code.visualstudio.com
(Yes. It says visual studio, it scared me off at first, but trust me, it isn't visual studio ;) )
woah, I built the same thing a week ago to learn how template tags work. I didn't do the b&w, though.
edit: holy fuck, classytags. That makes things easier, huh.
As mentioned by dAnjou, WSGI frameworks (including django) don't scale with websockets. For this you need another framework supporting async communication. I recommend that you use Tornado, because it's built specifically for this scenario. You can use it beside django, but I see that you don't use a lot of what django is offering you, so maybe it's a good idea to make everything runs on top of tornado? Only you can make this decision.
If all the browsers you need to support are in this list http://caniuse.com/#search=websockets, then you can use tornado's websocket connection directly. If you want to support older browsers which don't support websockets, then you can use sockjs-tornado https://github.com/mrjoes/sockjs-tornado.
It seems that you want to build a marketplace? They are complex pieces of software, and a lot of work is required to build them. Such an app is so complex that nobody can really help you on reddit. You'll have to split your app into smaller parts, and tackle each one at once (things like: customer user creation, seller user creation, seller inventory, item listing, single item display, buyer cart management, the payment flow, order status management, deliveries, etc).
As an ecommerce open source app I like https://saleor.io/ (although it's just a regular ecommerce site where only the platform admins are the sellers).
Well in most of my Django projects, I go with DRF, no second thoughts, UNLESS the API has to be async, then I go run to fastapi, it's pretty great. Now to your question, I will chose Angular over React any day, I worked with react for over a year and I hated every moment of it. Angular fits so beautifully with Django right out of the box it's ridiculous to me. You don't have to stray away from your Django basics, you create models, then you create services to interact with those models and you create components to call those services and perform actions. It's very organized, I wouldn't wanna work with react in the near future. But I would encourage you to use React, try it for yourself, you'll either love it or start loving angular even more.
IP Address isn't ideal if your users are behind a firewall and sharing a public IP.
A quick google for "django allow only one session at a time" resulted in this find:
​
https://dev.to/fleepgeek/prevent-multiple-sessions-for-a-user-in-your-django-application-13oo
​
That seems to detail a more durable approach. You should build what your use case demands, though. But the shared IP is something that can be overlooked.
Doesn't look like they use it for eCommerce.
https://www.mongodb.com/presentations/storing-ebays-media-metadata-mongodb-0
I have nothing against MongdoDB. I have used it before for storing logs. It is important to use the right tool for the right job.
Make a form that is JUST a file upload.
Add jquery.form.js and ajaxupload.js [see link below for my example]
Consider adding uploadify, as it's got a different set of functionality.
edit: add link
Form: https://github.com/servee/servee/blob/master/servee/contrib/media/document/forms.py#L1
Edit 2: This solution uses Asynchronous JavaScript and XML (well, actually in my case json), just not through XMLHttpRequest. Just because something is a buzzword doesn't mean it doesn't accurately describe what you're doing. Best of luck.
I'm not against channels but want to point out that video chat apps typically do more than connect two clients, they can also buffer and transcode so more devices can work with each other. I would opt for a microservice approach and have something like jitsu https://jitsi.org/api/ do the heavy lifting. Let Django do what it's good at: accounts and business rules.
DO's guides are quite good and as long as you're using the matching OS version I've never run into issues (outside of my own code failing)
Heroku doesn't allow you to listen directly to either HTTP or HTTPS. Instead, they handle incoming traffic and route it to your internal port (usually 8000 in gunicorn case).
This means you can't directly handle SSL on Heroku. You'll need to go with their paid option.
A workaround might be using a free CloudFlare plan that supports Let's Encrypt, and proxy traffic to your Heroku instance.
That "It lets you build high-performing, elegant Web applications quickly" text has been on the Django site since early 2006. Back then anything dynamic was considered a web application. These days with JavaScript frameworks and single page applications becoming more mainstream the definition is a lot more subjective.
I agree that it's a bit confusing though.
https://djangogigs.com/ is another good place. When looking for work, I use a bunch of recipes at ifttt.com to read RSS feeds for "Django" and send me emails. You get a few false positives from the "ALSO GOOD TO HAVE" section of some dopey listings, but it works well.
I ran into the same difficulties earlier. I ended up using gunicorn and nginx as this was simplest to implement. The most difficult element was aligning all the ports for various systems so they played nicely together.
Here's the tutorial I ended up relying on the most, but my conf file needed some changes. https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn
Good luck with the settings/conf files!!
Most large real world projects will require a mix of these things
- Querysets, prefetching and annotations. Getting performance from your querysets to prevent multiple queries hitting the database when they don't need to happen.
- How async tasks work, and how to implement them with celery and/or django q. This could be anything like sending an email and or performing a large calculation that the user doesn't need right away
- Polymorphism/ polymorphic models and when to use it and the advantages they bring
- Safe migrations. It doesn't seam like it but some migrations aren't safe on large projects/databases. This can lead to sites not working for users and is good to know about. This is a good starting point https://www.braintreepayments.com/blog/safe-operations-for-high-volume-postgresql/ it's useful to understand this with django projects
- Deployments can be handy to know about and understand, especially if you want to show off portfolio work.
- Once you understand this I'd recommend learning about a frontend framework and investigate how you can integrate that into one of your projects
I like the "dead man switch" approach from healthchecks.io
it's really simple if up-ness of a service is what you need to know. Your background jobs running on a schedule do a GET request to a specific URL whenever a successful execution completes.
The URL has a schedule: if it doesn't receive a GET ping within the defined schedule, it's an error (leading to email, SMS or webhook). Your tasks server can also do GET to {url}/fail
to immediately trigger the error. You group URLs by tag, and invite clients to the portal for their specific URLs so they can watch the healthchecks too.
healthchecks.io is not free, but it's cheap, nice to support a small developer.
​
Did I mention how simple it is :) This is great for small-teams or one-person developers
I (and countless other devs I imagine) have tried this a few times and I think it's not as useful as it immediately appears. I'm not saying it's a bad idea or anything, but I am less enthusiastic because:
A lot of the work that a scaffolding tool, or any library really, needs to do is convince you that it's making all the right choices and that you can either understand the choices it made or those choices are abstracted away. create-react-app or nextjs come to mind as examples of this done really well. So it is possible, but I imagine it is also much, much more work than it seems to do this well.
If you do really think the current style is a problem feel free to raise it on the discussion group to see what others think - we use MkDocs, so it'd be easy enough to change the theme to eg. the built-in mkdocs
style... http://www.mkdocs.org/
It's a shame it depends on Highcharts. This is a CC-BY-NC licensed library that is at least $390 to use in a commercial webapp. It's $90 if it's not a "webapp".
Honestly the money isn't the biggest issue here. It's that you have to pick through Highsoft's ridiculous definitions (wtf is and isn't a webapp?!) and license garbage to work out how much money you need to give them to be covered. And God help you if you upgrade, that's a whole new level of licensing hell.
It's not a drop-in replacement by any means but switching to Chart.js or something similar would benefit the whole project in terms of simplifying deployment. Perhaps making Highcharts available as an optional thing.
So we're both right:
https://www.djangoproject.com/weblog/2017/dec/02/django-20-released/
It looks like the biggest change they made in 2 was dropping support of below 3, but the reason they jumped to 2 was they are changing how they are handling version numbers from here on out.
https://docs.djangoproject.com/en/2.0/internals/release-process/#internal-release-cadence
It's a sad state of affairs when event organisers feel they have to step in and protect their speakers.
It's sad that little idiots get off on harassing women (in particular) off the internet.
It's disgusting that Google is so far removed from moderating YouTube now that it's essentially a cesspool you have to either disable, moderate extremely hard, or let bigots take over.
And I'm appalled that even in here you find people talking about censorship of people who clearly have no intention of discussing the topic, who only want to hurt, like that's the bad thing. Grow up. If some bell-end came into your place of work, stood behind you for the entire day shouting about the size of your arse, you'd probably want somebody to do something about it.
If in doubt: Stay on-topic and leave ad-hominem attacks for your feelings journal.
If you can't do that, go away. You're not welcome in the Django community.
I'm a django developer and all my machines run windows. What you are looking for is vagrant. It lets you run a headless virtual machine that has access to your project, and that you can ssh into. So all my editing is done in windows, and I use the command line in the VM for running django. If you have pycharm pro, it even has built in support for it.
Well, you can store JSON data directly into the database and have postgres search through it with various operators. If you've used something like mongodb, storing json directly into the database is really nice, especially if you have all the flexibility of being able to search through it with all the usual database queries.
I recommend this as well. We just implemented search for our application and used Postgres trigram indexes as described here: https://about.gitlab.com/2016/03/18/fast-search-using-postgresql-trigram-indexes/
It was really easy to implement and avoided adding another piece of infrastructure.
Are you only looking for django apps that will let you self-host all the comment data?
An alternative would be to use the free Disqus (disqus.com) service. It won't be self-hosted but the commenting and moderation features are great!
Well, for comments. I think most people at this point would implement something like Disqus (https://disqus.com/).
Tags are a simple foreign key relationship to another model that you would create called "tags"
social networks generally include some way via their own API's to share information. Or you could use an all in one solution like. (http://www.addthis.com/)
The harder stuff would be taking care of the static files, deployment to a server somewhere online, general SEO in your templates, etc. This would take an awful amount of time if you aren't already familiar with what would be required, but it is an amazing learning experience.
I don't see why Django should be involved in this process at all. This is the reference doc I tend to follow when setting up a new LE cert with autorenewal on servers running nginx: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-14-04
Stripe provide a checkout page and a page to switch between offers.
What you have to implement is just two objects. Offer and Subscription. An offer is just an object which holds the data which symetrically maps what is are your Subscription Prices.
And Subscription is an object which holds the subscription of a user.
So basically what you do is:
Go on https://stripe.com/docs/api
See checkout session (a page or payments) See Customer Portal (a page to mingle with subscriptions).
Create an objet Offer which maps Products and Prices in Stripe (see the doc)
Whenever u create an offer it creates a Product and a Price. And save the stripe PriceId into ur Offer object.
Whenever a user subscribes to an offer, u send this id to the checkout page (checkout session).
You may listen to webhooks from Stripe, like customer.subscription.updated and customer.subscription.deleted
When u receive a webhook, u handle it by creating a subscription object accordingly so u keep the state of the subscription in your app.
For customer portal, whenever ur users wants to manipulate a subscription, redirect them to there and stripe will send u webhooks u listen.
That's it.
Django can absolutely do this though it may be overkill. Check out the official Django tutorial or maybe even Flask.
We recently re-wrote our frontend from vuejs to react and used hooks. Its basically an easier to follow version of class based components so pretty much everywhere. I can't seem myself wanting to write in the class views now.
Lets say you have a component some state, with class views you have the constructor where you declare it, when it changes you need to have some logic in componentDidUpdate, and then you need to have logic in the render function for how to display it. If you get into a more advanced component with many state variables, it gets harder to follow what exactly is happening for each variable. With hooks, all of these different parts get brought together into one place sequentially after each other making it extremely easy to follow. This page of the docs shows it: https://reactjs.org/docs/hooks-overview.html, but to really see it yourself, take a component in your code and convert it :)
Basically makes your code from this:
foo() { var a = 0; var b = 1; var c = 2; } bar() { // var a logic // var b logic // var c logic } baz() { // var a logic // var b logic // var c logic } ...
to:
foo() { var a = 0; // var a logic // var a logic // var a logic
var b = 1; // var b logic // var b logic // var b logic
var c = 2; // var c logic // var c logic // var c logic }
Shodan is a search-engine for IoT devices, as well as things that should probably not be directly connected to the internet (power grids, etc.)
He just searched for a debug string on Shodan, which is just a variant of Google Hacking. Basically, if Shodan's crawler encountered a Debug page, it's now indexed.
I've only been doing some littler personal things here and there with it, but I love Digital Ocean (note that is my referrer link. Totally okay if you don't want to use it.) Each "droplet" (which is a VPS) is $5 apiece for the smallest instance. They go up from there, but still stay relatively inexpensive.
Otherwise I'd recommend Heroku or OpenShift. I've toyed with both of their free tiers and they work as promised. They can just get expensive outside their free tiers.
There are a number of large apps that still make use of function based views (Saleor is a prime example) but CBVs can be extremely useful if you are building a more complicated applications.
So you’ve got a few questions to ask: - Are you working in a team? What do they use? - How much do you expect the product to grow? Will you have a lot of repeated functionality? - How long will it take you to refactor them?
How did you install Postgres?
If you used brew install postgresql
it should have put it in /usr/local/
If you installed Postgres.app it should have added itself to your PATH
variable.
The which
command only works for executables that are on your PATH
.
If you installed postgres and started it; you should know where the binaries were installed and you should have a bin/
directory that has all of the binary programs associated with this postgres cluster.
For instance on my mac:
ls /Applications/Postgres.app/Contents/MacOS/bin/ clusterdb gdal_contour gdallocationinfo invgeod pg_basebackup pg_standby psql createdb gdal_grid gdalmanage invproj pg_config pg_test_fsync raster2pgsql createlang gdal_rasterize gdalserver nad2bin pg_controldata pg_test_timing reindexdb createuser gdal_translate gdalsrsinfo nearblack pg_ctl pg_upgrade shp2pgsql cs2cs gdaladdo gdaltindex ogr2ogr pg_dump pgbench testepsg dropdb gdalbuildvrt gdaltransform ogrinfo pg_dumpall pgsql2shp vacuumdb droplang gdaldem gdalwarp ogrtindex pg_receivexlog postgres vacuumlo dropuser gdalenhance geod oid2name pg_resetxlog postmaster ecpg gdalinfo initdb pg_archivecleanup pg_restore proj
as you can see I have not just the postgres programs, but also a bunch associated with with PostGIS ( which uses the GDAL and OGR libraries ).
You'll need to add that directory to your PATH
.
You can do this from the command line by saying
export PATH=$PATH:/path/to/postgresql/binaries/
but really you should add it to your .profile
or .bash_profile
so that it will be set for all future sessions.
You can use channels now. It is not part of core, but is a supported project.
> Official projects, like Channels, do not merge into the core django repository but instead remain as separate repositories and packages, living under the Django organization on GitHub. They have their own release schedule and backwards compatibility policies, but fall under the main Django security policy and oversight, and are guaranteed to work with the currently supported versions of Django.
https://www.djangoproject.com/weblog/2016/sep/09/channels-adopted-official-django-project/
Major drawbacks of using 1.5 or older is:
If you want to created a new site, but don't want to continuously keep it up to date, you can use the LTS (long-term support) release, currently 1.8, which will be supported until at least April 2018.
See here.
There's no work underway at the moment, no.
The DSF did include a limited amount of integration as part of their MOSS grant application - https://www.djangoproject.com/weblog/2015/dec/11/django-awarded-moss-grant/
I'm not sure the status of that at the moment, as the work on Channels is (rightly) taking priority. If and when the request parsing/content negotiation/response rendering tasks get prioritized you can probably expect the core team to issue a call for work (As they've done for the channels tasks - https://groups.google.com/forum/#!topic/django-developers/egFlHXopcpg ), where they list out the required tasks, and open applications from folks to undertake paid work to complete them.
Extended support for Django 1.7 ended last December...Unless I'm missing something, why wouldn't a new package be built for the latest LTS version (1.8)?
As others have said, Django 1.8.2 will be almost identical to 1.8.3. But to build the docs yourself:
tar -xzf Django-1.8.2.tar.gz
cd Django-1.8.2/docs
pip install --user sphinx --upgrade
make epub
Because Python is Python and we stick to style guides not whatever the author of your syntax highlighter felt like :) You've probably read it but just in case you haven't: stick to PEP8 - it will stop the people reading your code from going insane.
We're using weasyprint in production with python 3.4, it's really simple:
from weasyprint import HTML from django.template.loader import get_template from django.http import HttpResponse
def my_pdf_view(request): context = {'user': request.user}
# Render the HTML from a template html = get_template('my_template.html').render(context)
# Create a PDF from HTML pdf_data = HTML(string=html).write_pdf()
# Return the PDF as a response return HttpResponse(pdf_data, content_type='application/pdf')
So I have two different gmails open right now. One URL is:
> https://mail.google.com/mail/u/0/
and the other is:
> https://mail.google.com/mail/u/1/
There are also session cookies set up for those paths:
Name: S Path: /mail/u/0
Name: GMAIL_AT Path: /mail/u/0
and
Name: S Path: /mail/u/1
Name: GMAIL_AT Path: /mail/u/1
So when you log in with different accounts, you get a session cookie tied to a specific path. You request a certain path, the browser sends that session cookie, and the server maps that session cookie to the proper account.
Or something like that. :-)
Edit: So in Django, your login code would authenticate the user, create a session for that account, send a response cookie tying that session to a path, and then use that session cookie on requests underneath that path.
Note that the path digit isn't unique to your system, just to that user session. E.g., this browser is maintaining two session logins, so for the next session log in we'll use digit 2. It's kind of like nested sessions. Session-ception.
Anyway, there are certainly details to work out, it's not trivial. But it's not dark magic either.
Build a thing. Make something for you.
And definitely break down the work into small chunks. Like, real small.
www.obeythetestinggoat.com/book/part1.harry.html
This guy, and the Testing Goat, I enjoyed this.
Have fun.
See if this helps you, its come in handy for me. How To Set Up Django with Postgres, Nginx, and Gunicorn on Ubuntu 16.04
Did you ignore the file after it had already been committed? If the file is already being tracked, git will continue to track it even if you add it to .gitignore. Take a look at: https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore
I think you are maybe trying to do some premature optimization. Your site is clearly a dynamic site and would benefit from Django just dynamically rendering the pages for each request.
What you seem to want is Incremental Static Regeneration. Which have some good solutions out there if you are willing to rebuild your front-end in something more suited towards ISR.
I personally think you should deploy regular Django. If you happen to notice any speed issues then you can rather look into caching the DB data in memory to help speed things up. You just want to reduce the load on your database. You can do this using some kind of memory cache.
I would recommend either Heroku or DigitalOcean for a beginner wanting to host a Django site. Both are designed to be accessible to beginners and are extremely inexpensive - I believe Heroku is free for a single small instance. Heroku is more focussed on abstracting away the system administration completely so you just have to deploy your app. DigitalOcean gives you a bit more flexibility since you start with a Linux instance, but their guides are really solid and go into a lot of detail.
Good luck!
I ended up using this guide to configure hot standby. Seems to work pretty well. Django functions just fine in front of the slave DB until I try something that requires writing to the database (which fails with "InternalError: cannot execute INSERT in a read-only transaction" as expected).
How much time do you have to devote to freelancing? Python/Django are good skills to have, some frontend/javascript would be helpful as well.
Use places like reddit and hacker news to find gigs. For example here's the HN monthly freelancer thread - https://news.ycombinator.com/item?id=9127243
Imagine my surprise, I live right up the street, didn't realize it was in Philly this year.
airbnb query near djangocon, full week Wharton is in University City. Here's an airbnb query that gives a window into the reasonable area to look to stay. Basically anywhere on that map between 52nd st on the left to 38th st on the right.
North and south of that rectangle are Market St, which has the in-town L train, so anywhere on the L would be reasonable, south side of the rectangle is Baltimore Ave. (edit - Baltimore Ave is the trolley route which intersects with the L downtown so anywhere on the trolley would be good as well)
Anyway take a look in University City first and stick to the area bounded by those 4 streets and you'll have easy public transit or walking distance to the con.
Feel free to PM, anyone, if you want my local feedback on a choice.
Are you sure these constraints on nullable fields work as expected? Null is not equal to itself so you're going to get duplicates. (see for example this )
Yeah...basically what i've done is summarized pretty well by the commit history. You can check it out at github: https://github.com/coleifer/djangosnippets.org
If you want, feel free to submit requests for features here. Also feel free to fork the project and send pull requests.
you are missing the static files url pattern in urls.py
MEDIA_ROOT and MEDIA_URL in settings are also wrongly set.
Read the django tutorial but also have a look at the setup of this demo project
https://github.com/bread-and-pepper/django-userena/tree/master/demo_project
Funny that both Google and Mozilla fund Let's Encrypt and their certificates have been trusted by every major authority for almost a year.
You should implement https. Currently when I want to create a password, it's getting sent to your web site through my ISP in plaintext that my ISP can just look at if they want to, because your site doesn't support https yet - so not much point having a password if other people can see it.
> Database: not sure; considering SQL as it's the most basic?
Django's ORM assumes SQL, so you should definitely use that. Also, Django manages your DB using migrations, so you don't really need to use raw SQL. You just define normal python classes, and apply migrations.
> How does one decide which stacks to use, particularly Front End Framework and Database?
Matter of personal preference, mostly. I love python, and while JS is pretty nice since ES6, I wouldn't want to use it on the back-end. For front-end, really, what you are comfortable with. You can stick to React if you are comfortable with that, or you can give Vue a try if you don't want to write garbage soup (aka JSX).
> Structuring a project: this is likely the first problem I'm encountering right now. As a student who has never done a full-stack project, what is the typical way to properly structure a repo with different stacks? I'm searching for a GitHub repo template right now, but I'm open to any suggestions!
Docker, and docker-compose. I usually use Traefik for routing, with an nginx container for built assets, static, and media files, a python container for django, a postgresql container for the DB, and a node container to work on the front-end in the dev phase only. If you use nginx for routing, you can also treat the whole website as one, so you can use basic HTTP cookies for auth, don't have to deal with CORS bs, etc.
If you want SSR, you can also use a Node container in production, but that's not really necessary for deep web apps.
More like poor man's 9gag, it's a pet project I do in my spare time with a couple of friends.
We use it to test a lot of stuff, like deployment strategies, project management, SEO, etc. Just to avoid getting rusty.
I hope you like it. Any comment (constructive or the other) is welcome.
Update: Code is on github
This is done pretty well by the official Python extension (docs), backed by Jedi, with the conditions that your virtualenv is in your workspace (project directory) and you have `ctags` installed. Building workspace symbols is pretty fast (under a sec, usually done async at file save iirc).
I’m not a huge fan of having a gitignored .venv in the project directory itself, but it’s way more practical with VS Code. The right Python will be taken into account then.
I must disagree on point of documentation, even on django mailing list people agree that documentation is weak. I personally understood them just after reading the source code since then you will know how to use them besides generic places.
https://groups.google.com/forum/#!topic/django-developers/LMKNSZfIGv8
I go for the VPS route and use digitalocean ( https://www.digitalocean.com/ ). I love the panel and being able to spin up a new server quickly. Google for a coupon and try it for a month or two, if you don't like it you can always choose something else.
So you have three things to think about:
A shopping cart application that allows to customer to gather items and checkout, including discounts, coupons, discounts and sales, shipping charges, customer service orders, call center orders, order history, notifications, etc.
Payments, including either on-site or off-site checkout, payment gateways, payment processors, merchant accounts, PCI compliance, SSL, refunds, credits, chargebacks, etc.
Order management, including fulfillment, shipments, order tracking, cancellations, refunds, returns, lost & damaged re-ships, etc.
You can make things as simple or as complex as you like (a Wordpress plugin, a full-on customized cart/order management system). I've found inventory and order management to be the more complex animals. Sales, coupons, and specials tend to be the biggest PITA in shopping cart space.
Regarding payments, PayPal has a decent explanation of the different kinds of options you can use (Offsite, Gateway/Merchant combined account, or Gateway only). Their APIs also differ depending on what you're using.
I've had good luck with Authorize.net and it's parent Cybersource (for foreign currency payments), but you should look for a Gateway that offers the features you need: CC storage, recurring payments (though I'd use the CC storage with my own managed recurring due to out of stock situations), etc.
Anyway, it gets pretty complex with any significant order volume (100+ per day), so be prepared depending on your customer. And good luck!
Wow, thats one hell of a change log.
Reading through the whole thing, it's a lot of changes/fixes that will reduce the number of WTFs per minute I've run into when trying to learn the framework over the past month.
With the funding of Improved PostgreSQL support for Django, I'd say just go with Postgres. The array and hstore fields are a huge plus in Postgres. Full support for them in Django is coming. Hopefully v1.8. I've built a lot of Django projects, large and small with both MySQL/MariaDB and Postgres. I can't count how many times MySQL has puked during migrations and left me to clean up the mess. Also, if you're on a Mac, Postgres.app makes it dead simple to setup for development.
Right now, doing it pretty simply. Using fabric to update using a git pull(and other necessary tasks).
Ultra simple compared to things like ansible, but for our current needs it works out great and scales well.
thanks! UI took a lot of my time as it was not intuitive at all for me in the beginning. What I did here is to start from a Bootstrap template, you find plenty on Google, and then improving it with illustrations. For icons and illustrations, I used icons8 which is super useful as you can color them according to your website.
I haven't used apache for years, so I found you a post :)
https://stackoverflow.com/questions/5682809/django-static-file-hosting-an-apache
Your STATIC_URL in settings.py should match the alias location you set up https://docs.djangoproject.com/en/1.7/howto/static-files/
Well, if these bots don't affect your site performance, you can just bail on it. Otherwise, perhaps you can filter them with Cloudflare Workers. I won't advise to filter it in the Django site.
One minor suggestion :-
You can start using https://www.cloudflare.com/ since you have lot of images which are getting served from nginx cloudflare will cache them locally on their servers so you will save up on lot of requests.
So you need something to handle the client-side logic as browsers expect everything to involve a full-page refresh unless javascript tells them otherwise.
You've got various options without calling in the big guns (react, angular, ember etc - overkill for what you want)
Roll your own jQuery Ajax call to a Django view that returns either JSON or a HTML fragment
Look at Pjax: https://github.com/nigma/django-easy-pjax
Intercooler is very cool and quite lightweight. I'd almost go as far as calling it Pythonic ;-) http://intercoolerjs.org/
virtualenv is actually a python package that allows you to setup a clean environment for your project (for example if your system has a django 1.4 package and you want to use 1.7 in a project and 1.8 on a different one you can do that with two virtualenvs), if you want to use a python version different to the one you have on your system I would recommend pyenv with the pyenv-virtualenv plugin instead of just virtualenv.
Try to setup pyenv, if you need help after that I could give you a hand.
Regex is OK once you get the basics - which is all you need for Django.
I struggled for a while, but found this YouTube vid really helpful: https://www.youtube.com/watch?v=kWyoYtvJpe4
and http://regexpal.com/ the Quick Reference is very handy.
[\w-]+ .... [\w-] means any word character (a-z, 1-9) or -. The + then means one or more of them. So [w-]+ actually means any number of non-punctuation characters (plus the minus sign).
In your example this allows the slug format of /category/this-is-a-slug/
\d+ means 1 or more digits (0-9).
A short story:
I maintain a Django based CMS for a company. It was my first freelance gig ever and I taught myself a lot along the way. I actively avoided learning any sql and relied heavily on the Django ORM to get everything done.
It was built on 1.6 which didn't include migration support yet so I was using south.
Anyways, I hadn't touched the site for a few months and I got asked to add a few features. I had to alter some existing tables in the database... when I tried to run the migration I was met with a bunch of errors and a crippled database because one of the south migration files was corrupted ( I have no idea what happened ).
Fortunately, I had just started learning SQL the week before. I looked at the postgres error logs, found out about the offending query, and quickly figured out how to fix it (some kind of ALTER TABLE statement)
This was the day I learned to respect SQL, because without it, I don't know what I would have done, and this company's active production site would have been bricked until I figured it out.
Now, I avoid using ORMs when I can and just run raw queries... they're faster, and much more powerful. Plus, you can do some cool things with SQL knowledge if you're interested in data at all. I recently found a long forgotten phone number in a 3 year old text by querying the messages database from my old iphone for specific words.
I have used onesignal in the past. what you do is:
i know this doesnt answer your question, but i find it pretty easy to use highcharts instead, then you don't have to worry about writing files to disk. highcharts is very feature-full, as well. i just use django templating to build the js object for the chart.
I highly recommend Vue together with django-webpack-loader (although you can prototype and use Vue without webpack, e.g. straight in your browser after including the Vue import)
​
If not, there's really nothing wrong with writing vanilla JS components, jQuery components, or whatever you are comfortable with... but if you are interested in productivity, then the fastest way is to re-use the open-source libraries that are already out there. Just as with Django and its ecosystem of libraries, you can build frontend apps very quickly if you adopt the patterns and component libraries from a popular frontend framework like Vue, React, Angular, etc.
​
In your case, let's say you want to implement search/sort/selection over a table of data for your invoice feature. That can be a few lines of code/configuration using a pre-implemented "Table" component from a component library like Quasar, or maybe a few hundred lines of Vanilla JS that you write yourself. Or it might be 50 lines using a framework like Vue, without any other library support.
Until JavaScript observable objects are more pervasive, there must be some kind of a getter/setter to be able to trigger change events for properties.
Object.observe has only found support from Chrome and Opera.
> I don't see much point in dedicated learning of language.
Yeah, the easiest way to pick up a language is to do something in it... might as well be django (or Flask!!!)
You could get away with something much more lightweight like flask or bottle.
I would modify your script so it also saves it current status to the database, then just use a simple view & template to display the script's status & the newest data. For error reporting, I would catch every unhandled exception, logging the exception, it's value and the fact that the script has stopped into the database, then you can have it exit.
You could make a toggle
view that forks a new process and marks the script as running in the database. If the database says it's already running, the view could kill the script instead(maybe store it's pid in the db when you start the process). You can tie the view into your status page using a button that points to the views URL.
If you don't want to have to refresh the page, use a timer & AJAX to update the status information & send the toggle
requests.