Django Development Server - django

Just to give you some general context of what I am doing, I am currently in the process of making a mobile app for university students to notify them when a seat becomes available in a previously full course.
For my project architecture, my web service stack is setup very similar to a LAMP stack: Linode cloud ubuntu instance for linux OS, Apache2 for my HTTP Server, MySQL for my relational database management system, and Python for my programming language.
Also, to gather the data needed for my project, I am going to web-scrape via a python script with beautiful soup and selenium (for timed delays when loading the webpages), and plan on implementing cron jobs for minutely scrapes to continuously update my database on my LAMP Stack (specifically the number of seats available in a particular course) which will then send any updates of newly open seats to the mobile app (which I will code in the future, but have not gotten to yet).
I am having a LOT of trouble installing Django on my server. Thus far, I am able to starting up the Django development server in terminal, but when I try to access the project / default Django admin interface via web browser (every time I type in my servers IP address and port 8000 it refuses to connect). I have checked my firewall settings, followed all the online recommendations of inputting my server ip etc and am currently at a roadblock.

You didn't include the command you use to run the development server but try:
python manage.py runserver 0.0.0.0:8000

Related

Running a flask application on a local network with a domain name?

I am doing a side project of transitioning my companies inhouse accounting app to a flask based web site.
I was just testing today to see if I could deploy onto the local network for everyone to access, and that worked will enough however it was my computers local ip ie something like 192.168.1.212:5000.
Is there a way I can run the flask app off my computer and on my computers local network where they could go to something like ourcompanyapp.com and get the app?

Django Application

I have finished coding a Django App. In that app I have created two models in order to record some project information. Also I am showing project locations with markers on a map (OpenStreetMap) by using leaflet.js.
I will use this app only by starting an offline server like "python manage.py runserver". I am using "Firefox" to display the django app.
I really wonder if somehow the information that I keep in my django models or the markers on the OpenStreetMap is somehow reachable by others via on Firefox or leaflet.
Thank you very much in advance.
If you are in the same wi-fi network you can run python manage.py runserver 0.0.0.0:8000 and then your application will be visible for everybody by typing http://your-pc-up:8000
If you want to make it public you have to buy domain (or register free domain) and put it in your vpc / free hosting. There are plenty of tutorial out there which show how to host an application.
This tutorial is really easy and straight forward: http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
You can use ngrok service which gives you domain such as https://c2757c5f.ngrok.io and other users can visit it by accessing this url. In addition, this url can be visited from anywhere!
See more details by visiting here
If you want other users can visit you website from you local server, then you can run manage.py runserver 0.0.0.0:8000. Your app is visible to other users on same network by accessing this http://your-ip:8000/
You could know you ip by using ifconfig command on linux or ubuntu

Host Django site on windows on lan

I have a site that I want to expose to a bunch of colleagues that serves as an interface for some Machine learning tools.
I’ve made the site in Django 2.0 and would like to serve it from a small windows PC under my desk, and then from a more dedicated server once it’s operational.
I’ve had a look around and it looks like my options are using uWSGI or Django it self to serve the site. Obviously Django is mich slower, but on a PC with an i5 i recon it should be able to handle a couple of requests a minute, which is the peak traffic I’m expecting.
FastCGI appears to be depreciated, so what other options, prioritizing ease of confit on my part are there?
So anyone in a similar situation:
I ended up using waitress as the server and whitenoise to serve the static files.
This appears to work sufficiently fast and requires little configuration, once you have have worked out how to get the static files going with whitenoise.
Django itself can serve pages to other machines on your network. SImply start the local server with this command
python manage.py runserver 0.0.0.0:8000
Then, you can access the local website by requesting http://<dev_machine_ip>:8000. Obviously, this is a very simple and inefficient solution if you want to provide this website to many users connected all at the same time. But for tests/demo purpose, it is very handy

ecommerce django app on webfaction versus VPS/DS versus Cloud Servers like EC2

Firstly, some background - I have been mostly using VPS/DS and EC2 for the django apps I build for the past 3-4 years.
On webfaction, I have only been deploying "trivial" apps or "personal blog apps" using both django and wordpress.
My biggest hesitation about deploying anything serious (with large amount of sensitive personalised user data such as addresses and phone records or ecommerce related data or even accepting a Paypal related transaction) on webfaction is that it is a shared hosting environment.
I like webfaction a lot because they have made it really easy to deploy django apps without the need for me to spend some time doing system administration and installing my own packages (which I obviously need to do on a clean EC2 instance or a VPS/DS instance on linode for example).
The question is - is it very unsafe to use webfaction (since it is a shared hosting provider and I can actually list the other users' home directory by running "ls -la" after I ssh in) to run an ecommerce application or an application which has a lot of personalized, sensitive user data? I would appreciate specific technical examples which can help me better decide whether or not to run a "simple" (yes, I know the word simple is dangerously ambiguous/undefined) ecommerce app - which probably will use the paypal payment gateway on webfaction.
I can address the specific concerns you have listed:
While you may be able to see other user's files, it's because they haven't changed the permissions on their files. You can use standard linux file permissions to keep other users from reading or writing your files.
chmod 600 file
You will most likely be storing your information in a database hosted by webfaction. While it is a shared enironment, you do get your own database that is protected by a password and a username. In short, it has the same security in place that a database hosted on a VPS would have.
While you do have to take extra steps to ensure the other users on the system cannot gain access to your information, it is certainly possible to keep your site secure in webfaction's shared hosting environment.

Django Deployment

I am given a responsibility in my project to develop a Equipment tracking tool with following requirements
New Equipment can be added by admin to a particular user
Once equipment is assigned to a person he will a request to accept the request so he will be responsible
User can transfer his equipment to other users.
At the same time Admin should be sent a mail or message whenever there is a change in status.
It should be deployed locally on a PC( So it is not actually a web app) that is connected to network which can be accessed by everyone
I thought I can use Django for this( I am new to it ), but I do not know much about deployment on a local PC , How can I do this, or is there any better Idea for this?
It still sounds like you want a web app, you just won't be deploying it on a traditional web server. One thing to note, client versions of Windows (XP, Vista) will limit you to 10 incoming connections per computer.
You'll want to follow these instructions on how to install Django. If you haven't installed python yet, I'll recommend that you install version 2.5, since that will include sqlite, an embedded database that makes it very easy to get started developing with Django. Django includes its own development web server, which you will come across naturally as you go through the tutorial.
Start by installing and then jump right into the tutorial. Your deployment options will be much easier to understand once you're comfortable with developing in Django.
Try http://docs.djangoproject.com/en/dev/howto/deployment/#howto-deployment-index
and if you should deploy using IIS then try http://code.djangoproject.com/wiki/DjangoOnWindowsWithIISAndSQLServer