Django Install Not Visible - No Errors - django

I recently did a successful Django install, and everything went as expected. No errors. But, nothing shows up. It is as if I had never installed Django.
There are no errors. Checking Django/Python versions returns as expected. From the console, I can create new projects/apps, run migrations, create users, etc. Everything seems to work. Except, when I go to mydomain.com, it just loads the old site's index.html as if Django doesn't exist.
I realize the above question isn't a good question. I figured out my problem before posting the question and decided to post my answer below with the question for future reference should others have the same issue later.

After the fruitless task of deleting and recreating my project files, I eventually figured out what happened with my Django installation. I had never enabled Passenger. On the web host in this case, DreamHost, it is just a simple checkbox in the control panel to enable, but I never did.
Other than the fact that I should have remembered I need to do enable Passenger for Django to show up, a couple things should have tipped me off. There was no tmp folder with a restart.txt file. I manually added it (that file's important), but didn't stop to think about why it wasn't there. Also, the html files were loading without being in the public folder.
That gave me an hour or so of frustration today, so I thought others might google this later and find this useful. Searching for "Django site has no errors but still doesn't work" wasn't a fruitful avenue for me.

Related

Django Rest Framework browsable API breaks when changing the port

I'm currently developing my first app with DRF and I'm pretty impressed by it and the browsable API it has build in. However, when I change the port where I host my application (both in manage.py aswell as in the runserver command), all the buttons stop working. I can still click on links to make sure resources where created, but that's about it. I also can't log in and the POST forms don't appear, which is really the most annoying part. Moreover, when I change the port back to the default 8000, it's still broken.
Don't really know if I can post an example of this. It doesn't seem to depend on anything in the actual code. It just happens when I change the port.
So while I don't know what exactly caused it, a CTRL-reload has fixed it for now. Still pops up from time to time.

I can't sign into the Django admin login page

I have started multiple Django projects with like four different tutorials. Every single time I try "python manage.py createsuperuser", the admin login page just loads and loads and never goes anywhere. I want to make it absolutely clear that I haven't touched a thing in the code and everything is default code. I migrated everything before login. I've tried deleting the database and re-migrating. None of that works. Can someone help me? I have made around 10-15 accounts and NONE of them work. The page just keeps loading indefinitely and never goes anywhere. I've looked at EVERY stackoverflow post and no answers work. I started a virtualenv, downloaded Django, didn't touch the code, made migrations, I followed every tutorial TOO THE LETTER(!!!) and this is what I keep getting. The current tutorial hasn't changed in default code and he signed in with no problems. I'm assuming if he did, I can...I don't think putting code in is necessary since it's all virgin code, never touched. I didn't even make any apps yet.
I've tried deleting database and re-migrating
changing the password of current superuser
deleting the entire project and following everything the instructor said (TO THE LETTER!!!)
I have made 10-15 superuser accounts and none work
This sounds similar to a problem I was seeing. I wrote a question for it here (no answers yet): Django local dev server hangs with chrome after form submission. Works in firefox
Are you using windows and the chrome browser? Try using firefox to access the admin page and login. That worked for me. I'm still trying to figure out why Chome doesn't work, though. Like you, I created a brand new project from scratch; sometimes Chrome works and most of the time it doesn't. I've also found that hitting the stop button while the browser is sitting there thinking, then refresh, makes the logged in admin page show up.

Cannot select Image File using djangocms-filer

I hope someone can help out with this one. I have been using djangocms to build a simple frontend centric website for a client so they can maintain their own content. There is nothing fancy in this setup. Just a few template.html files, a little css and djangocms to pull it all together. There are no other forms, models, views or anything at this stage. Just pure djangocms.
Originally I was working with django 1.8.6 and the image picker seemed to work fine. I could upload my files and next to each one there is a selector icon which works and all was great. See below image. This was using cmsplugin-filer.
Then I tried to upgrade the website to Django version 1.11.13 and I started to run into this problem. The file select that you see above is no longer available to the user. I have spent days working on this and in my travels I found that apparently cmsplugin-filer is now deprecated. So I removed it and switched to the recommended djangocms-filer install thinking that might solve my problem...but no. After many many hours of head scratching I figured it must be something in my project throwing things out, so I have done a 100% clean install using the prescribed djangocms-installer. Other than connecting it to a postgresql database, it is a completely vanilla installation, and yet it still does not work. All I get is the image below. A simple tick box but no way of selecting the image nor anyway of saving what I have selected. Uploading files is fine and I can create folders and images upload into them perfectly fine.
Below is a snapshot of my pip freeze showing everything installed in my virtualenv and the associated versions.
My settings file is almost 100% standard so I don't understand why I can't get this to work. Note: If, when I am adding the plugin to my template, I don't select the Choose File Button but simply drag an image into the grey rectangle, it all works fine. My file gets uploaded into the unsorted uploads folder and the image is selected into my template all in one go, but using the choose file route, where I have more control over my files and how they are stored, doesn't.
Does anyone have any idea what I might be missing please?
UPDATE:
Django CMS overrides some static files and there are some old ones in your browser cache. You need to clear your caches or open the page using incognito window.

view.py not updating in Django with wsgi

My django application has recently started exhibiting this behaviour in live.
When I check out a new release and expand it into the appropriate directory (replacing the existing version), the new versions of the files are not picked up.
I've tried restarting apache many times and have ps -ef | grepped for rogue apache / wsgi processes, but can't find anything wrong.
If I introduce errors directly into views.py (like changing the spelling of a method) then it doesn't complain, even after restarting the server.
but if I delete views.py altogether, then it does complain that it can't find the file.
The functionality that I've changed is to do with the emailing of some data.
The emailing is still happening whenever I refresh the page, but the formatting that I've introduced is not being invoked.
Also, I've asked it to forward to a new thankyou page, but it's continuing to forward me back to the form. (and still emails the form content)
any ideas?
Have you removed all .pyc files that might be left over from the previous versions of your view.py?

My Apache (mod_wsgi) Django app only lists the files instead of the actually running website/application

My Apache (mod_wsgi) Django app only lists the files of my website/project instead of the actual running website/application. My guess is that it's mod_wsgi that is the culprit but I'm not really sure. What are some of the causes of this?
Don't put your Django site code in a directory Apache can serve up. Right now if I knew the actual site host name, I could get down your Django settings file and get access to your database password information.
Anyway, ensure you have gone and set up a basic WSGI hello world program before you attempt to get Django working under mod_wsgi. In doing this, ensure you use the official mod_wsgi documentation and not some arbitrary persons blog post. As such, go read:
http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide
http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
Also go watch the video presentation at:
http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_Presentations
as it steps you through basic configuration as well as what to do for Django. It covers all the basic things that people do wrong.
If you still can't get it to work, then heed the comments in:
http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Asking_Your_Questions
about useful information you should supply to any forum to help people solve your problem.