Installing django on dreamhost (help a newb out) - python

I'm trying to get django running on my dreahost account. I've been trying to sort of use two tutorials at once: the one on the dreamhost wiki and the one in the django book.
I installed django using the script on the wiki page, but I ran into trouble immediately while trying to work through the django book. It says:
To start the server, change into your project directory (cd mysite), if you haven’t already, and run this command:
python manage.py runserver
This launches the server locally, on port 8000, accessible only to connections from your own computer. Now that it’s running, visit 127.0.0.1:8000 with your Web browser. You’ll see a “Welcome to Django” page shaded in a pleasant pastel blue. It worked!
Those instructions seem to assume that you're developing locally, not on a shared server. Where the heck am I supposed to look for the "Welcome to Django" page after starting the server? In my webroot? No dice.
Anyway, I tried to blunder ahead through the django book to its hello world tutorial (chapter 3). But once I've edited the view file and the URLconf, I don't get a nice clean "hello world" text. Instead (as you can see) I get an "import error".
Any help would be greatly appreciated.

Don't try and learn Django via your server. Install it on your local computer, learn how it works, develop your project, and then install it on Dreamhost.

Your project assumes that 1) your app is called "mysite", and 2) mysite is a package, e.g. mysite/__init__.py exists. If either of those are false then correct your code and/or file structure.

This is an old post and am sure you have found the answer by now. I have solved this problem by using the command
python manage.py runserver mydomain.com:8080

Related

Download and setup a Angular/Django site from server to localhost?

Hi I am new to Django and have been googling for a whole day without any success.
Basically there is a live/working website built with AngularJS, Django and PostgreSQL (Ubuntu 14.04) and I am trying to download all the files and clone the site into my localhost (Ubuntu 14.04).
After I downloaded the folder and finished install the required packages on my localhost, I run:
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
The server runs without reporting any errors.
However, some of the links are directed to a 404 page, such as this:
http://127.0.0.1:8000/city/chicago
Whereas in the live site, it would direct to the correct working page.
Can someone tell me what may have gone wrong in the process?
Thanks.
Try editing the settings.py file set the DEBUG value to True. Instead of a 404 you should get a full debug of the actual request and see what exactly is missing (I suspect missing data as #NightShadeQueen pointed).
Also you might have a look at django debug toolbar which prints the executed sql queries as well and run them against your local database to see what exactly they return.

Django deployment final step

I have a Django project with 1 app that is working locally and I am trying to make it work on the server but I imagine I am still missing something...
The steps I have followed are:
1) create a virtualnev
2) Install django and the libraries I need
3) copy my local project to the server, keeping the same directory structure
4) create the file passenger_wsgi.py (python passenger_wsgi.py did not return any error)
After this do I need to do anything like python manage.py runserver? Or with this I should be already able to see the site through mydomain/my project/ my app (when I do ot just get an error 404)?
I have read the django book and followed the tutorial, but this part is not well described anywhere...
Thanks in advance for any help!
Deployment is explained in the documentation.
You need to actually serve your application with some kind of HTTP server and something to run your python code. Some of the possible combinations are:
nginx with uWSGI
Any web server as reverse proxy with gunicorn
Apache with mod_wsgi
Your hosting service may or may not give you the choice or even the possibilty to do this.
There is a list of Django friendly hosters in the Django wiki.
Well firstly you might want to go through the previously asked questions.
When you are deploying using passenger you do not need to run manage.py runserver , etc. The passenger_wsgi file should take care of it.
You might want to check this link out, in the first answer also contains link to Dreamhost which details quite extensively on how to achieve the same.
Visit Deploying Django app using passenger
From my personal experience I found Nginx and uwsgi setup to be much more easier to handle and work and debug in the logs, but this is subjective to your needs and platform you may have.

Herkou site looks different at launch then django local server site

My issue is that when I view my site using python manage.py runserver or foreman start, I can see my site perfectly.
However, when I git push heroku master on the surface everything appears fine as no errors are given. But when I view my site with the Heroku given site link, I do not see my updated site as I see when I view my site using python manage.py runserver or foreman start.
I am building my site using 'pinax-theme-bootstrap` and my virtualenv is on my desktop directory.
Does anyone have a solution as to why this may be the case?
Here is a list of suggestions on how I would approach this issue with Heroku.
You should try heroku restart. This restarts your application and can help pick up new changes.
I would clear my browser cache as often I do not see changes on my web page if the browser has cached them.
I would check that the git repository on Heroku matches my local one in that it has all the newest changes made on my local server.

What are the first steps in order to start with Django/Python 2.7?

I have installed Python 2.7 for Windows, and downloaded Django-1.2.3. Now, I want to build my first website with them. How can I get to the first hello world page, in a browser? Can I use Apache/XAMPP to go to http://localhost ? What are the base principles to get a website working?
Thank you
Just read the excellent and thorough Django tutorial. Django comes with a built-in simple web-server that you can run your websites on. It's just a Python script you run, and then you go to a port on localhost (by default port 8000). It's really quite simple and well-explained in the tutorial.
Specifically, look at the section named "The development server" in the page I linked to.
Personally I found this basic web-server to be very useful for all stages of website development.
# django-admin.py startproject myone
# cd myone
# python manage.py runserver

Is there a 'hello world' website for django? OR (I've installed django, now what)?

I'm learning Python and decided to start familiarizing myself with the (defacto?) Python web framework - django.
I have successfully installed the latest release of django. I want a simple 'hello world' website that will get me up and running quickly. I am already familiar with web frameworks (albeit for different languages) - so I just need a simple 'hello world' example website to help me get going.
Ideally, I don't want to mess up with my Apache server settings (as I am still experimenting), so I want to use the lightweight web server that django bundles. I cant seem to find how to do this on the django website though - no doubt someone will post a link and shame me ...
So, does anyone know of a link that shows how to get a simple 'hello world' django website up and running with minimal fuss?
Next step? The (free, online and excellent) Django book.
Writing your first Django app, part 1 was a lot of help.
"Hello World" of django is the "Polls and Votes"
I think the official tutorial says it all...
cd /path/to/your/code
python django-admin.py startproject mysite #creates dir 'mysite'
python manage.py runserver

Categories

Resources