If you have a choice, do not start on 1.8. It is already out of LTS support. Django 1.11 is the current LTS release, so if you plan on deploying a Django site in the next year, I would recommend starting with it.
In fact, if this is your first time learning Django at all and it will be a while (6+ months) until you use it, I would recommend learning 2.x first. The next LTS release, 2.2 comes out next April.
Here are the full details if you are interested.
You could also use local environment variables, but I'm not sure if that's best practice or not. Here's how you can access them with python
To have full control, you'll want to use a VPS like DigitalOcean, Linode, etc.
DO happens to have excellent tutorials, but there's no reason you have to use them to use this tutorial. The beauty of VPS's is that it's basically a straight-up Linux box, so use any one you want.
Here's one of those excellent tutorials I mentioned, that covers your stack.
There are lot of blogs and tutorials on internet for django deployment. But if you want to learn in detail , i would like to recommend you to read books on <strong>Safaribooksonline.com</strong>
Django Deployment Workshop this video tutorial will help you
As always whenever I ask a question to anyone, I find the answer shortly after. There is no way to do this natively within django.
https://github.com/bernii/querystring-parser which I found via this stackoverflow works perfectly.
Deployment is what separates the men from the boys. God's speed.
https://docs.djangoproject.com/en/1.10/howto/deployment/
https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04 (great tutorial if you are running on a linux machine)
On the question of allowing customers to delete their accounts, I have been deactivating them and then anonymising any fields which can potentially be used to identify the customer in order to comply with GDPR. This way I can preserve more of a historical record. That may or may not help you decide whether you want a nullable FK to customer.
Regarding Order statuses, consider 'complete', 'refunded', 'partially refunded', 'in progress', and 'requires authorisation' (if you use Stripe and the customer is sent through SCA). Maybe you don't need it right now, but you might in the future.
this article might give you some ideas on how to structure it if you want to have models in a relational database. http://www.vertabelo.com/blog/technical-articles/what-do-poker-blackjack-belot-and-preference-have-to-do-with-databases
You could look into uploading the video on Vimeo and embedding an iframe that is only whitelisted for your domain. The guy that runs the Laracast website does it this way, check it out. Here's an example.
It makes the video really hard to download unless you know how to use use something like youtube-dl to bypass the domain restriction.
To clarify: Most "local" computers can not be reached from the Internet. They only have an internal IP address (e.g. 192.68.x.x) and the Internet router also serves as firewall blocking incoming request from the Internet.
There are 2 ways to solve this:
If you plan to host a website that runs 24x7 my advise is to use a cloud service or run it on a VPS.
I never used django-chartit. I have had pretty good success using highcharts (and the charts looks really nice too).
http://www.highcharts.com/demo
Note highcharts requires a fee if you are going to use it for comerical purposes.
I haven't found the need for a full IDE for Django development, but I've heard good things about PyCharm.
I just use Sublime Text 3 with some Django-specific plugins and Anaconda.
also i know there aren't any rules regarding asking question, but do post your code things you have tried and shit. This question would get downvoted to hell on SO. https://hastebin.com/supivazohu.cs
Saving this post because I have also been trying to learn Django but never find any good use for it apart from a blog..
Try this tutorial for integrating Django with apache: link. It worked for me.
I advice you to take this course:
https://www.coursera.org/course/db
It is a free online course made by Jennifer Widom, a professor at Stanford's. It has been very helpful to me in the past. The course is probably way too detailed, but it's awesome. Keep in mind that Django's ORM and database APIs allow you to define your models and query them without requiring you almost any explicit SQL.
Ah, didn't realise there were others with similar titles. I meant the one by Antonio Melé (Packt Publishing)
Here's a link for reference:
Here’s the Bootstrap Docs on how to use their margins.
If you need a refresher on CSS margins check this article out.
Hi u/MisterRenard.
7 months ago I had minimal coding experience. I'm not Django expert but I have made a basic web app that real-world users use and like. Here is the path I took and am reasonably happy with:
A lot of it is difficult but everything is solveable with the power of google and reddit
I think you were probably asking about the logo on the top left. He's running Debian as an operating system.
In Linux, any distribution (type) can have any of many user interfaces. His - I think - is GTK.
This is more than likely when websites implement a system that redirects urls through themselves. For example on Deviantart, any link that is external to their website looks like https://www.deviantart.com/users/outgoing?http://www.mydomain.com/where-ever-i-want/
and then more than likely they're tracking that click. On the outgoing page its just a simple redirect to the proper url.
Google does this heavily through every application they offer. Click on any url and if you watch the url fast enough, you'll see your constantly redirecting through their own click tracking system.
I’ve been using Linode for messing with django / containers. It’s a full Linux vm in the cloud. I use the least expensive option which is $5 / month. Check them https://www.linode.com/ If you like use my referral link: https://www.linode.com/?r=a2d6d56488c4b2d4af31c1fbc2500d56445f08e4
To paraphrase Greenspun's tenth rule:
Any sufficiently complicated Flask program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Django.
But, building that "ad hoc, bug-ridden" website is really informative. I also started with Django, then switched to ASP.Net MVC, and then back to Django. It still felt like a lot of magic. I felt like I was memorizing, not learning.
I then helped add a feature to a website using Pyramid and did a great tutorial using Flask. Using frameworks that don't have everything built helped me better understand what was going on under the covers in Django.
There are two paid developers as part of the Django fellowship:
Everyone else evolved is volunteering their time.
You can also just see it at the top of the page, though.
A photo taken from a phone of a computer screen showing the source code of the page... is just so unnecessary.
I mean, heck, you could just link the page.
I use PyCharm, it has pretty good support for Django.
I found out about a particular feature in the past few days that further increased my appreciation for PyCharm: the Vagrant+Virtualbox support. I had been struggling with how to do local testing of Django projects in a way that is closest to my target platform (Ubuntu, but for me that's not the platform I want to code on). I figured the answer would be to run a VM, but setting that up manually would be a bit of a pain. PyCharm's Vagrant+Virtualbox integration makes it easy. Of course as you are already running Ubuntu this may not interest you much...
One last thing: while I haven't used it myself and am unsure how well it supports Python/Django, Visual Studio Code runs on Linux.
Yup, did that and also transferred the site files, but now I'm just back to the Server block html page from the configure nginx tutorial.
I'm hoping so, Right now I'm just getting a "this connection is not private" message when I go to my url, so I'm hoping all I need to do now is set up SSL.
Edit: Well, I set up SSL and transferred over my project files, but that didn't fix the original problem involving the landing page from the tutorial to configure nginx.
I just used this tutorial to get my server up and running yesterday. If you're running Ubuntu 16.04 it may help.
Could you post your config files and the output of your sudo systemctl status gunicorn?
That might help to track down the problem.
Please ignore /u/booooomba's rudeness.
It would be helpful to see your nginx conf. I recently had similar issues when setting up a django production server on an Ubuntu droplet. There are some extra troubleshooting steps at the end of this tutorial that should apply to your situation as well:
if you can run pip3 but not pip, you can just run that instead.
But if you are using the default version of python included with MacOS (not sure which version that is these days) you might want to upgrade to Python 3.6 if it is older than that:
http://osxdaily.com/2018/06/13/how-install-update-python-3x-mac/
I'd recommend the homebrew option (scroll a little further down) as through homebrew you can install various other software you might want to run together with Django, like PostgreSQL.
Hi,
I've come to that point:
<script>
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
var post_base = {{object_list|safe}}
console.log(post_base)
var map = L.map('map').setView([49.175573,20.072700], 11);
for (let index = 0; index < post_base.length; index++) {
console.log(post_base[index]['fields']['lat']);
var image_path = post_base[index]['fields']['images']
console.log(image_path);
marker = new L.marker([post_base[index]["fields"]["lat"],post_base[index]["fields"]["lon"]]).addTo(map)
.bindPopup("<img style=10%; src={% static 'images/" + image_path + "'%}/>");
}
</script>
​
and it looks ok but now i can't generate path to picture in popup because js can't resolve parsing by django here:
.bindPopup("<img style=10%; src={% static 'images/" + image_path + "'%}/>");
Still confused on what you need to know about the front end to be honest, if you want to know how everything works I can post/send that.
I'm using bootstrap4 to get access mainly to the components that getbootstrap.com has to offer. I haven't done any custom styling or added any styling sheets. I've only been adjusting whatever I pull from the website.
The front-end is just an informational page that has a landing page, which can link to an index for the barbers, which can link to individual barber pages. It also can link to a page that show the haircut options available, and a contact us page which has not been filled out yet.
I have some libaries in mind for each of these.
Stripe Connect can help with a lot of that. It's designed for building a marketplace where you take payments on the behalf of others. It doesn't handle all the local sales tax though. You'll have to add that logic on your own.
I wrote about my experiences with Stripe Connect and Django here.
checkout auth0's blog if you want to implement it by yourself: https://auth0.com/blog/complete-guide-to-react-user-authentication/
​
Google Oauth is similar to Auth0
It looks like it's possible to use React with Django HTML templates, take a look at this: https://reactjs.org/docs/add-react-to-a-website.html
But that is kind of missing the point. If you do that then you are using Django as a server-side template rendering web application so it is both your backend and your frontend. You get a lot of performance improvements, user experience improvements, and over software design improvements if you completely separate your frontend and your backend. To do this you would need your React application to interact with a REST API.
As I posted elsewhere on this sub, I just recently deployed a very simple Django project that used OAuth to access the Instagram API (more info here). I posted all of my code on GitHub, if that helps.
If you use Stripe's Checkout:
https://stripe.com/docs/payments/checkout
there's very little JS involved aside from some copy/paste. The trick becomes figuring out how to get signals to update your models /manage access and how to present that info to your users. Most of which is just python/django.
https://stripe.com/docs/development#python
Start from their Pypi package, go through other integration steps, and follow along with their documentation.
Third-party articles may be helpful for a more condensed set of info, but I would always advise starting at the source.
According to stripes documentation, the method handleCardPayment was renamed and i'm guessing its data was modified because the documentation does not fully match the result you posted.
I don't know Stripe enough to help debug this much farther.
Reading the result response you just linked, error is not in the data returned and because you just do if (result.error)
statement, it fails and goes into the else block which tells your browser to redirect to the update-transactions page.
From here I think you need to figure out the correct Stripe methods to be using, the parameters it needs and see what data it returns.
According to Stripes documentation, the Subscription object should have a status value:
https://stripe.com/docs/api/subscriptions/object#subscription_object-status
See what it contains and do your checks with that.
Alright, so my models.py looks like this.
Even if it is right, I'm getting stuck when the tutorial talks about using the API. Creating a question doesn't automatically give it the options that the Choice model has, and I can't add it by doing
q.choice_set.create(choice_text="Strongly agree")
which is how they do it, I need it to get linked to the option already defined within the Choice model.
Any ideas?
Not sure where exactly the difficulty is. My first search for "django gmail send email" was this result which seems like all you need if you're only dealing with a single Gmail account.
Where are you running into trouble?
I plan on using gvisor, I know using docker as a sandbox environment isn't a good idea. I believe there's also firejail for Linux. This article used gvisor. https://dev.to/narasimha1997/building-a-secure-sandboxed-environment-for-executing-untrusted-code-7e8
> but for visualizing the data (i.e. if you're removing Tableau entirely) I'd say you're better off with a data visualization SaaS or open source platform like Plotly Dash: https://plot.ly/products/dash/
I would disagree here. Yeah, Django alone won’t help you much, but Django and something like highcharts can make a really slick back office/BI tool.
I never tried this but assuming it works since his Youtube plugin works, I assume his Video plugin also works, If you are using Django-Ckeditor, Django-Ckeditor-Video-Plugin
I started with "Django 3 By Example: Build powerful and reliable Python web applications from scratch", and then, went to "Decoupled Django". Besides that, the documentation is essential.
http://www.opengts.org/ https://www.traccar.org/
Check these before you build your own. But yes, Django will work well. You'll probably only need a single API for the buses to hit. Depending on what client the bus uses, that could be custom or could receive a standard format.
We used cloudinary for a small project. Comes with python package to easily manage your images. You can even do some edits like cropping and rotating. And it was free for our purposes.
I know I can use a slug but the issue is the backend is going to look like this
https://www.screencast.com/t/lje2gWC8l
and I don't know which Environment DEV is supposed to belong to Project 1 or Project 2. Do I need to do some type of pre save that somehow calls the slug and the name project1-dev, project2-dev etc...
This is almost a static site (eg. Pelican) with an external testing tool (some SaaS) bolted on.
>I want to build a website for the class.
The question is - why? Is it because you need something truly custom, or you don't want to pay for SaaS options like Teachable, or is it because you want to try something new?
Thanks so much for the detailed explanation, it certainly helped and cleared up a lot of things. > Regarding the VNC stuff: I'm afraid that an Ubuntu server doesn't really have a GUI which will be useful for you.
I found this guide for using VNC on ubuntu, could you please see if this is something I can try? I'd like to work in production the way folks in my office work through Netscalar gateways, with virtual desktops.
Thank you. 1. Basically the databse is on the server side but the admin won't make sense of it as it would be encrypted. 2. I am aware 3. Yes. e2e is not the right term, i think 4. I mean, decrypt the data on the client side then search. I've heard of the project called EteNotes/EteBase (https://www.etebase.com/). I think it is similar to what I want to do.
I posted this link a few months ago. An article showing that among a selection of established django projects, the use of cbv vs fbv is 50/50.
https://dev.to/omenapps/modern-django-project-examples-58mm
In short, learn both and use the one you find more useful, or mix and match. There's no rule or best practice. Just two tools for accomplishing an end result.
I personally find cbv is great for basic crud, but sometimes fbv is easier when doing complex/multiple operations.
Are you using webpack to bundle? You can export your typescript as a library, and call an entrypoint from within HTML.
That way you can simply use the SO method to define a JS variable, then inject that into your entrypoint. You can just declare that as any
in your TS function signature.
There's a guide to do that here: https://webpack.js.org/guides/author-libraries/
Make sure you you include library
in the output
config, see "Expose the library" in the link above.
Have you done https://www.djangoproject.com/? It's a decent place to start. I agree with you about the scattered tutorials online and youtube may not get you on your way. I think I've done 2 tutorials from youtube and some of it just doesn't work and others were hard to follow as there were some gaps that caused it to not work. I only got the general idea of how some of it works but having zero web development experience and lack of work experience makes learning django challenging but all I can say from learning how to code in the past is it takes a lot of practice and having a job where you can utilize some of it makes a big difference as you have more motivation to succeed.
Quoted from the Django Docs
>Standalone scripts
>
>Custom management commands are especially useful for running standalone scripts or for scripts that are periodically executed from the UNIX crontab or from Windows scheduled tasks control panel.
Quoted from my article
>Often times during Django project development, there is a need to write one-off scripts that do something.
>
>...
>
>Before we get into how to create them, here are some use cases that may get your mind rolling:
>
>1. Clean-up inactive or expired user accounts
>
>2. Send a summary email report to site administrators
>
>3. Send notifications to users based on custom business logic
There is no explicit call to action that my examples are the only things you can use this concept for. That is largely up to the developer and the scope of the project. The key is to make new developers aware of this ability, as I wish I knew about it earlier for various reasons.
Using subjective opinions to make an argument against the quality of an article disappointing.
Have you gone through the Django tutorial?
You should not be trying to do serious manipulations of django admin. It's designed for basic CRUD. As the docs state
> The admin’s recommended use is limited to an organization’s internal management tool. It’s not intended for building your entire front end around.
Django's templating is very easy to use and flexible, but trying to make significant modifications to admin is going to be a struggle. Follow the tutorial, and learn how to build a basic front end.
You can / should look into Git for saving your project at different stages safely.
Easiest way is using the GitHub Desktop client on Windows or MacOS : https://desktop.github.com/
This will store the code part of your app, you should not store your database in it. You can store requirements via a requirements.txt file or a pipfile using pipenv.
That modal code seems accurate according Bootstrap docs, so it's likely not the source of the problem. Time to troubleshoot.
<p>Hi!</p>
in the template, for instance)?If you load your own CSS after Bootstrap, then you won't need to use !important
. The reason you had to use !important
for basic elements like body
and input
is that Bootstrap's CSS has rules for them and they took precedent because they came later. Also, scripts should almost always be placed at the end of the HTML body, right before </body>
to ensure that they load after the rest of the content. In this case, though, it doesn't look like the page is using Bootstrap's JS, because it requires two other scripts to run that aren't installed. If you needed Bootstrap's JS, you'd need to load the other two scripts (JQuery and Popper) from the getting started page. But in this case it's better to remove the script because it's not doing anything.
Also, since you're using Bootstrap, you might as well remove the style from <div style="width: 1400px; margin:0 auto;">
and add a class from one of Bootstrap's containers. They have it set up with media queries to make sure it scales well on mobile and desktop.
> Online docs is more than enough to make a casual website: https://docs.djangoproject.com/en/3.0/intro/install/
Though you'd probably also want to learn basic HTML/CSS, and/or a front-end framework such as Bootstrap. Django only takes care of the back-end.
> In front-end, it's kind of the standard thing to do.
This is definitely not standard for Bootstrap 4. Here's the official docs on theming Bootstrap:
https://getbootstrap.com/docs/4.4/getting-started/theming/
Have a look at it. It's actually DRY and very straightforward to upgrade.
I'm guessing you're using the bootstrap4
crispy template pack, right?
If so, that's the default behavior of Bootstrap 4. You can even see it in action on their docs.
I don't think there's anything you can do except to render the field without any bootstrap style applied to it, and just have a plain HTML `input` show up, which will show you the file name.
This isn't really django-related, because you're just talking about the frontend, but most likely you're having problems because you haven't set up the Bootstrap Grid correctly - https://getbootstrap.com/docs/4.0/layout/grid/
Maybe you could use FullCalendar, in particular this example:
https://fullcalendar.io/docs/date-clicking-selecting-resource-demo
> When filling the "From Email Address" field, you may notice a warning when entering an address at yahoo.com, aol.com, gmail.com, and some other domains. This warning indicates you should not use the address as your verified Single Sender because your messages will likely fail a DMARC check. For more details, see our comprehensive DMARC page.
https://sendgrid.com/docs/ui/sending-email/sender-verification/
You'll have this issue no matter where you go. You cannot send From a gmail type address using a mail service because nobody but google owns gmail.com and can verify its a valid sender.
Django 3 By Example was an excellent book. The author explains concepts well, but I’m not sure if it’s the amount of depth you are wanting. Highly recommend checking out though.