Skillcrush Problem
I am taking the basic Python class on Skillcrush.com. At the end of each section I am required to save my projects to Github. For example:
—--------------------------------------------------
WHAT TO DO:
Open your Replit account and find the final code for the projects you want to showcase.
Choose at least one site to post your work on, like an online portfolio, LinkedIn(opens in a new tab), or GitHub(opens in a new tab). The more places you can post your work, the more likely a future employer will take notice! If you don’t have a LinkedIn or GitHub account, you can sign up for free!
For each project, write an engaging and descriptive title for your work. For example, a title like “Python App” doesn’t tell the viewer what the app does and doesn’t convey any excitement. Instead, choose a title like “Multi-language Translator App.” Doesn’t that sound intriguing?
For each project, write a brief description to tell the viewer what the app does. Be sure to mention the Python skills you used and any relevant modules in the description.
Include the Replit links to your work so viewers can see your code and interact with your apps!
Save or submit your post to your sites.
Take a screenshot of one of your posts and submit the image below to finish strong!
—---------------------------------------------------
So, this is what I created:
https://replit.com/@santiagofajard2/Hard-Redesigning-for-RESTful-Routes-Starter-3#main.py
It worked perfectly during codecamp, but in Replit I am getting several errors:
With Skillcrush I pay to have access to folks who are supposed to help me out. Here is what they sent me:
—-----------------------------------------------
Fork your code from the Build a Directory of REST Requests step by
clicking the edit button next to the repl title. Then, click the Fork
button below the description box.
In the "/api/villains/" route, create a for loop that uses villain to
loop through the villains variable. The data from the for loop will
populate the empty data list.
Add an .append() method under the for loop to add data to the data
list: data.append().
Inside the method, create a dictionary: {}. The dictionary will have
five key-value pairs, which you’ll write in just a second.
The dictionary keys should match the objects from your Villain class,
including "name", "description", "interests", "url", and "date_added".
For each key, the value is the villain variable with the key name. For
example, the first key-value pair will be "name":villain.name and the
second key-value pair is "description":villain.description.
Add value for the "interests", "url", and "date_added" keys.
Add the jsonify() function in the return statement below the for loop.
In the jsonify() function, add the data list variable to convert the
data from the list to a JSON object.
To complete the '/api/villains/add' route, add the jsonify() function
to the return statement at the very bottom of the add_villain()
function.
In the jsonify() function, add a success response status: {"status":"success"}.
To complete the "/api/villains/delete" route, add the jsonify()
function to the return statement that’s in the if statement.
In the jsonify() function, add a success response status.
Run your code and test out the add and delete forms. Are your female
supervillains rendering on your front end? If not, make sure the
data.append() is located in the for loop and that the return statement
has the jsonify(data) function. If you’re seeing your female
supervillains.
Once your female supervillains are rendering to your front end, it’s
time to celebrate. You did it! Note: You’ll add the final villains in
the next lesson, so your app looks great before you add it to your
portfolio.
Then, grab a link to your code by copying the browser URL of your repl.
Paste the link to your code below and submit it!
—-------------------------------------------------------
I believe the issue is the database, as it doesn't appear on the solutions version of the code. It doesn't transfer when attempting to copy-paste it from the solution that works. I got it to show up previously because I had run the previous code deleting the database file in the forked version and it would appear updated with my new code. The errors that appear insinuate that the issue lies amongst the Jsonify import, which is a function of the library Flask (which configures the database). Below are pictures of the database needed for the assignment. As well as pictures of the supposed HTML site that it should create.
I reached back out to Skillcrush for additional help, but they just keep sending me the same text. I am very new to coding - and this is my first time working with Python. Their advice does not seem to be working so I thought I would join CodeNewbie and see if someone can help me out.
Any and all guidance or advice is greatly appreciated!
KeyRat
Top comments (0)