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
Related
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
What is the best practice or tutorial to set up a droplet to showcase my React/Express and Django fullstack projects on a single server?
I've found NGINX server blocks, but not sure if I'm going in the right direction.
I want users to go to a React site that will have links to several other React or Django projects running on the same server.
Finally figured it all out.
You can use all of the regular server block documentation if you have another domain name or subdomain name you want to point to the server. That documentation can be found at Nginx Documentation on Server Blocks and Digital Ocean post on server blocks
If you want to make multiple server blocks within subdirectories of the root server you can use location as seen here in the Nginx documentation: ServerFault question/answer
I was wondering how I could let Chrome connect to my network. I am using a website called Codeanywhere.com and I was using a Django container. I used the built-in terminal and installed Python 3.4 and Django 10. I created a project and ran the server, and it said it had created one at this ip: http://127.0.0.1:8000/. However, whenever I try to access it, it the site can't be reached. If it helps, I am using a Chromebook Thinkpad, and it is a school computer. They do block things with Lightspeed Systems and they have a lot of blacklisting things going on. I am trying to learn Django for a project. Below is a screenshot of the screen when I try to access the server.
My screenshot of the error screen.
I can't embed my image yet, I don't have 10 reputation points :/ It's a link instead.
Mistake #1
The server isn't located on your local host, so you need to go to the provided server. for example, when I opened a project I got this instruction:
To access your application over HTTPS, make sure your application is running on port 3000 and use the following link:
https://mysite-{username}551936.codeanyapp.com
Mistake #2
you should run the server with a specified ip commend - and use 0.0.0.0:3000 instead of the usual localhost, like so:
python manage.py runserver 0.0.0.0:3000
In addition, I would reccomend you to read the "mysite Container" file which explains everything about the setup in detail.
I'm new to mezzanine and Django. I have set up a site, everything is working but I can only launch the server on "development". I would like to access de site on the port 80 on the internet instead of internally, as I have no way other than redirecting the port via SSH to access it. I would like to know how to do that.
And another question, is Nginx included with Mezzanine automatically ? Cause I have a tuned up Nginx server there and I'm not sure what I need to do, if run it with my existing Nginx server or with the one included with Django if that is how it works .... thank you for bring some light on this.
NGINX is not included with Mezzanine, it's an entirely separate piece of software, similar to Apache.
Mezzanine includes a fabric script which can automatically set up a production server if you'd like to use it, and will install NGINX on the server for you, among many other things.
Given your question, I can't recommend enough that you read and understand all the related documentation on this topic. Start with the Mezzanine link below, it references many other documentation sites - Django, Fabric, NGINX, plus more.
Enjoy the adventure: http://mezzanine.jupo.org/docs/deployment.html
I currently have a django project that I am working on. The project is sitting on my remote webserver, and I start it by running manage.py runserver 0.0.0.0:8000. Howver, if I try to access the site via domainname.com:8000, I can't see the site.
How can I view a django project remotely like this? Do I need to do setup using apache? Punch a hole in the firewall? Is there an easy way?
This is strictly for development purposes.
You need to bind it to an IP, not 0.0.0.0.
Also, you may want to check that firewall rules are not stopping you from accessing port 8000 (I did this this morning!)
You can use ssh tunnels. It's easy to set up in Windows with Putty (look at this example for manageing postgresql) or google how to use tunnels with ssh in Linux. I think this is amazing thing, since I first time get to my databse on remote server :)