schema in Django with sqlite - django

I am new to Django, i was going through this Django site for building up a basic app.
They have explained the procedure's to use either SQLITE3 , MYSQL, postgresql... I used SQLITE3 as they tell about it being a single large file which makes it easy to use initially.
The problem i am facing is to use .schema to check the database created. I checked certain sites which tell about using it. But i am getting stuck and i m confused to use it.
What i did was
$sqlite3
sqlite>.schema
sqlite>
This above code didnt work, then i came across a forum where they told to install a add_on to Mozilla fox, which didnt work to me as there was a compatibility issue. I even specified the path name where i have this database file located.
$sqlite3
sqlite> /home/ntan3/Django-1.2.3/mysite/eg_sqlite.db
which gave an error saying wrong syntax near '/' .
The thing is could successfully run
the sample application explained by
the Django site.
but i wanted to see the Database created. Please Help
could anyone guide me a proper way to do it? even a specific link is also helpful.
Thank you.

This is basic command-line stuff. You need to pass in the path to the db file when you type sqlite3:
$ sqlite3 /home/ntan3/Django-1.2.3/mysite/eg_sqlite.db

Related

Is there a way to write to a file in online CMS from a local C++ program?

I created a very customized leaflet map on a Bitrix website (they forced me to, not my choice). Now other coworkers who are basically "afraid" of code need to be able to add markers to that. I already created a C++ program where they can simply enter all the details they want (what category, whats the popupcontent etc.) and it spits out the geoJSON code for the marker for them to copy and paste into the website.
To make it even more easy for them I am wondering if there is a way to basically have my program connect to the internet, go to the backend of my website and, after asking for login, adds the code to the respective .js file that contains only the marker code.
I have been googling the problem but unfortunately couldnt find any other related posts.
Okay I finally found the I guess easiest way, I will force my colleagues to install python and write a little thingy to concatenate the code and upload it using Selenium. Thanks for your help guys!

db.sqlite3 file encoding in django

I am beginner with Django and I'm using PyCharm IDE. I was watching a tutorial following along when I noticed my sqlite file that comes with Django had a question mark next to it (the guy in the video didnt have that). So I clicked it and it prompted me to associate my sqlite file with a certain file type. To experiment I selected the python(.py) file type. Now when I open up I get an error with corrupt code (or at least that's how it looks to me. The error is "File was loaded in the wrong encoding: 'UTF-8.'
When I click on that error message I am able to select from dozens of different encodings. I'm assuming that's the issue but I don't know for sure. Does anybody have a solution to this issue. Thanks.
I will add two screenshots to clarify what I mean.
Screenshot 1, list of options if I right click
Screenshot 2

why can i not create a home page in ruby on rails

I was trying to create a new home page.
why do i get the following error "DL is deprecated, please use fiddle...could not find generator controllers" i've tried to locate the following code in readline.rb file but cannot find it
if RUBY_VERSION < '1.9.1'
require 'Win32API'
else
require 'dl'
class Win32API
DLL = {}
Your question has very little detail, so it's not clear at all what you're using, I'm guessing you're on Windows, and I googled your error and it came up with a bunch of vagrant links so I'm guessing you're using vagrant. There's this issue and although it's closed, the author's comments suggest that he's still working on a fix.
Update
Sorry, I just noticed that the owner says it's fixed for the next installers.

Cloning Open Cart admin language issue

I'm trying to clone one fully functioning opencart website to another. The front-end of the website is in Dutch and the back-end I have left English default.
Here are the steps I have taken:
Copy database to new environment
Copy files and edit both the config files(config.php and admin/config.php) to match the server paths.
when i go to test the site, all seems to be working fine, until i go to the admin section where i find this blasted error which seems to be very common:
Notice: Error: Could not load language dutch! in /opt/www/prezent/graviolashop.de/HTML/system/library/language.php on line 39
I'm not sure if this is a path issue or something wrong with the db?
I have googled this issue but none are specific to my perticular case. Has anyone had this issue and resolved it?
Thanks.
If it's unable to load the language and you've copied them over as you say, then this is going to be a config issue. Ensure your path is exactly as it should be. A good way to do this is to create a file such as error.php in your root website folder. Then put some erroneous code in it like
<?php
dfs sdf sd;
Then call the file at www.yoursite.com/error.php, and it will show you the path in the error which you can copy exactly. One other unlikely but possible problem could be permissions, but the former is far more likely

Apps with label XYZ could not be found

today I ran into an error and have no clue how to fix it.
Error: App with label XYZ could not be found. Are you sure your INSTALLED_APPS setting is correct?
Where XYZ stands for the app-name that I am trying to reset. This error shows up every time I try to reset it (manage.py reset XYZ). Show all the sql code works.
Even manage.py validate shows no error.
I already commented out every single line of code in the models.py that I touched the last three months. (function by function, model by model) And even if there are no models left I get this error.
Here http://code.djangoproject.com/ticket/10706 I found a bugreport about this error. I also applied one the patches to allocate the error, it raises an exception so you have a trace back, but even there is no sign in what of my files the error occurred.
I don't want to paste my code right now, because it is nearly 1000 lines of code in the file I edited the most.
If someone of you had the same error please tell me were I can look for the problem. In that case I can post the important part of the source. Otherwise it would be too much at once.
Thank you for helping!!!
I had a similar problem, but I only had it working after creating an empty models.py file.
I was running Django 1.3
Try to clean up all your build artifacts: build files, temporary files and so on. Also ./manage.py test XYZ will show you stack trace. Later try to run python with -m pdb option and step through the code to see where you fail and why.
You don't specify which server you're using. With Apache you'll almost certainly need a restart for things to take effect. If you're using the development one try restarting that. If this doesn't work you may need to give us some more details.
I'd also check your paths as you may have edited one file but you may be using a different one.
Plus check what's still in your database, as some of your previous versions may be interfering.
Finally as a last resort I'd try a clean install (on another django instance) and see if that goes cleanly, if it does then I'd know that I'd got a conflict, if not then the problem's in the code.